python-openapi/openapi-schema-validator

`readOnly` / `writeOnly` support for OpenAPI 3.1

fivepapertigers opened this issue · 1 comments

Seems like read/write context-aware validators are only implemented for OpenAPI 3.0. Any reason not to implement a similar interface for 3.1?

For some context, I'm leveraging the openapi-core library and noticing that readOnly and writeOnly work great when validating against 3.0 specs, but do nothing with 3.1 specs.

p1c2u commented

The answer is very simple, because OpenAPI 3.1 specification doesn't define readonly/writeonly.

the reason can be found here

When discussing the final details of aligning with JSON Schema, we identified there was particularly thorny issues with the readOnly and writeOnly properties that are defined in JSON Schema but described to have slightly different behavior in OpenAPI. In order to achieve our goal of full alignment with JSON Schema, we had to drop the OpenAPI behavior. Technically, this change might “break” some piece of tooling out there. We haven’t found it yet (we’re still looking). Semantic versioning would insist that this change be denoted as 4.0.0. However, this update to the specification is not such a major update, rather there are a few small breaking changes.

https://www.openapis.org/blog/2020/06/18/openapi-3-1-0-rc0-its-here