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'm building specs for an JSON:API compliant API. The standard requires to include the entity ID in the request itself for the PATCH/UPDATE methods. Where as the ID field needs to be absent in the POST request.
With the current implementation, it is required to create 2 different schemas for POST and PATCH/UPDATE requests, only differentiated by the missing id property.
It would be great to be able to mark a property as readOnly by the used request method.
The text was updated successfully, but these errors were encountered:
See also #1497 (I'm hesitant to call this a direct duplicate because that issue took a long detour into JSON Schema land).
The fundamental issue is that JSON Schema (to which OAS delegates request/response modelling) does not have any concept of the context of a schema, such as it being a request or a response, or the HTTP method in use. In OAS 3.1 readOnly and writeOnly are, by default, annotations only and do not have any effect on validation, and the interaction with the required keyword was removed.
You could extend the schemaObject (in OAS 3.1+) with additional keywords or your own vocabulary, but presumably you would be looking for some tooling support?
I'm building specs for an JSON:API compliant API. The standard requires to include the entity ID in the request itself for the
PATCH
/UPDATE
methods. Where as the ID field needs to be absent in thePOST
request.With the current implementation, it is required to create 2 different schemas for
POST
andPATCH
/UPDATE
requests, only differentiated by the missingid
property.It would be great to be able to mark a property as readOnly by the used request method.
The text was updated successfully, but these errors were encountered: