Ability to handle Schema objects FIXED FIELDs eg readOnly, writeOnly
libopenapi-validator currently is unable to handle fixed fields in schema objects, an example being writeOnly. This property specifies that the schema object may appear in a request but not to come back in the response, as noted https://spec.openapis.org/oas/v3.0.3#fixed-fields-19 However libopenapi-validator has no reference to these fields and this behaviour. Is there a plan to implement this?
You found a gap! Nice. This needs to be added.
Hi @daveshanley - Any thoughts on this? my fear is that this may may be an issue with the underlying jsonschema module....
I have not looked any deeper into this yet. It may be a gap down there, or it could be something that can be controlled by libopenapi I don't know yet.
I have not looked any deeper into this yet. It may be a gap down there, or it could be something that can be controlled by
libopenapiI don't know yet.
Thanks - the support of this construct is spotty across a variety of tools (eg Spectral gets tripped up as well). It would seem to me that at a very basic level when a payload is checked against a schema it needs to be in the context of a request or a response, without that the schema validator couldn't assess readOnly/writeOnly.
I've looked at this in the swaggest package, which similarly defers to the jsonschema lib for validation. The conclusion I've come to is that the jsonschema spec differs meaningfully from the OpenAPI spec when required is handled together with readOnly and writeOnly, and that this behavior can't be deferred to a library designed to validate jsonschema.
This means that this lib will have to do its own schema walk and implement its own handling.
The more I think about this the more I believe (to your point) that you really need to generate different schemas that simulate these OAS constructs.
If memory serves I think there is a way in JSONSchema to declare a property must not be present.