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
Objects properties in OpenAPI can have writeOnly or readOnly attributes, meaning, they're only valid for requests or responses. At the same time the properties can be required.
In python, as long schema object is modelled as a single pydantic model, it means a field can be both optional and required (required, but only when either the object is used as either a request or a response). Pydantic doesn't allow for a conditional validation of properties.
Ideally, schemas should be modelled as two or three classes - base class with common properties, request class with writeOnly properties, and response class with readOnly.
Since the client might want to re-send an object coming as a response, it would be nice to have a helper method to generate the request variant from the response.
No description provided.
The text was updated successfully, but these errors were encountered: