Skip to content

feat: support readOnly and writeOnly#547

Merged
deepmap-marcinr merged 1 commit intooapi-codegen:masterfrom
NaridaL:read-write-only
Apr 19, 2022
Merged

feat: support readOnly and writeOnly#547
deepmap-marcinr merged 1 commit intooapi-codegen:masterfrom
NaridaL:read-write-only

Conversation

@NaridaL
Copy link
Copy Markdown
Contributor

@NaridaL NaridaL commented Apr 7, 2022

https://swagger.io/docs/specification/data-models/data-types/#readonly-writeonly

You can use the readOnly and writeOnly keywords to mark specific properties as read-only or write-only. This is useful, for example, when GET returns more properties than used in POST – you can use the same schema in both GET and POST and mark the extra properties as readOnly. readOnly properties are included in responses but not in requests, and writeOnly properties may be sent in requests but not in responses.
If a readOnly or writeOnly property is included in the required list, required affects just the relevant scope – responses only or requests only. That is, read-only required properties apply to responses only, and write-only required properties – to requests only.

@deepmap-marcinr deepmap-marcinr merged commit a4d612c into oapi-codegen:master Apr 19, 2022
@NaridaL NaridaL deleted the read-write-only branch April 19, 2022 15:11
adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
Co-authored-by: Adrian Leonhard <leo1fr@bosch.com>
adrianpk added a commit to foorester/oapi-codegen that referenced this pull request May 31, 2024
Co-authored-by: Adrian Leonhard <leo1fr@bosch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants