You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to reuse a schema similar to the 'reusable bodies' section described here, with the difference that I'd like to reuse the same schema in the requestBody and in the response:
This works, but I'd like to make an exception for an 'id' property of the PetBody. Assuming that a Pet's unique identifier gets created after the POST on the server, I wonder how I could split or compose the PetBody schema such that an 'id' could be marked required: trueonly in the response?
Something like this works, but I'd also like to reference the id parameter and possibly a few more through additional references which doesn't seem to work according to #1467
There's no need for separate schemas. You can use a single PetBody schema and define id as required and readOnly: true:
Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only.
I am trying to reuse a schema similar to the 'reusable bodies' section described here, with the difference that I'd like to reuse the same schema in the requestBody and in the response:
This works, but I'd like to make an exception for an 'id' property of the PetBody. Assuming that a Pet's unique identifier gets created after the POST on the server, I wonder how I could split or compose the PetBody schema such that an 'id' could be marked
required: true
only in the response?Something like this works, but I'd also like to reference the id parameter and possibly a few more through additional references which doesn't seem to work according to #1467
Thanks in advance for any good suggestions,
Marco
The text was updated successfully, but these errors were encountered: