We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
readOnly
writeOnly
readOnly/writeOnly fields for Schema Object properties is not reflected in the output type information. Specification of readOnly/writeOnly is here.
Example input:
openapi: 3.0.3 info: title: example version: 0.1.0 servers: - url: https://example.com/v1 paths: /path: put: summary: Put Example requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ExampleObject" responses: "200": description: Success content: application/json: schema: $ref: "#/components/schemas/ExampleObject" components: schemas: ExampleObject: type: object required: - id - name - value properties: id: type: integer readOnly: true name: type: string value: type: integer writeOnly: true
I got
api/@types/index.ts:
api/@types/index.ts
/* eslint-disable */ export type ExampleObject = { id: number name: string value: number }
api/path/index.ts:
api/path/index.ts
/* eslint-disable */ import type * as Types from '../@types' export type Methods = { put: { status: 200 /** Success */ resBody: Types.ExampleObject reqBody: Types.ExampleObject } }
The id is readOnly: true and therefore not needed in the request, while the value is writeOnly: true and therefore not needed in the response.
id
readOnly: true
value
writeOnly: true
Expected output is like below:
/* eslint-disable */ import type * as Types from '../@types' export type Methods = { put: { status: 200 /** Success */ resBody: Omit<Types.ExampleObject, "value"> reqBody: Omit<Types.ExampleObject, "id"> } }
Omit the writeOnly properties for the resBody type, and conversely, omit the readOnly properties for the reqBody type.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
readOnly
/writeOnly
fields for Schema Object properties is not reflected in the output type information.Specification of
readOnly
/writeOnly
is here.Example input:
I got
api/@types/index.ts
:api/path/index.ts
:The
id
isreadOnly: true
and therefore not needed in the request, while thevalue
iswriteOnly: true
and therefore not needed in the response.Describe the solution you'd like
Expected output is like below:
Omit the writeOnly properties for the resBody type, and conversely, omit the readOnly properties for the reqBody type.
Describe alternatives you've considered
Additional context
Environment
The text was updated successfully, but these errors were encountered: