Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0 Scope] Make readOnly and writeOnly fully aligned with JSON Schema #2169

Closed
tedepstein opened this issue Mar 2, 2020 · 4 comments
Closed

Comments

@tedepstein
Copy link
Contributor

This is a placeholder for a follow-up task to consider in the next major release cycle.

In #1622, we discussed the new definition of readOnly and writeOnly annotations in JSON Schema. OpenAPI 3.1 cannot simply defer to this definition, because it has different semantics that would amount to a breaking change. But we should consider making this change in 4.0.

@handrews
Copy link
Member

handrews commented Mar 3, 2020

wait, does that mean that @OAI/tsc has decided to make these incompatible with JSON Schema in OAS 3.1?

@tedepstein
Copy link
Contributor Author

@handrews, OpenAPI 3.0 specifies that a required property that is also readOnly or writeOnly becomes required in one direction, but not the other. This is not expressible in JSON Schema. In #1622, I explained that I'd like to change OpenAPI to remove this incompatible behavior, but it's a breaking change, so I don't think we can do it in 3.1.

So yes, OAS 3.x is incompatible in this one case because it assumes context-sensitive validation, which JSON Schema doesn't support.

In this comment, I described three possible workarounds, assuming we don't magically solve this JSON Schema compatibility issue in 3.1. In this comment, @MikeRalphson says we should publish those workarounds somewhere, and (presumably) accept that we can't fix it in 3.1.

If other TSC members want to weigh in, or if anyone has a better idea of how to handle this, please chime in.

@handrews
Copy link
Member

handrews commented Mar 5, 2020

@tedepstein that is not how I interpreted @MikeRalphson's comment (I probably read the last several comments in that issue too quickly). I will follow up over there.

@MikeRalphson
Copy link
Member

Believe this can be closed, as resolved for 3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants