-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Allow booleans in place of any top-level schema field #2598
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
Conversation
Signed-off-by: Mike Ralphson <[email protected]>
Wouldn't this require updates to the metaschemas as well? specifically
should change edit: actually no, the schemas themselves are one layer down, under the properties... and at the 'schema' definition, where the 'meta' dynamicAnchor is defined, we already have |
@karenetheridge I explicitly said...
... but thank you for pointing out that the v3.1 metaschemas may be out of step with the markdown source-of-truth. Ping @jdesrosiers |
Great, thanks for clarification! Would it be possible to explicitly mention in 3.1 that Boolean JSON Schemas are not supported as top level Schema Objects? It's kind of implied because the name of the spec object is Schema Object but, when implementing tooling it gives space for interpretation and I was actually inclined to support Boolean JSON Schemas in 3.1 tooling (as top level Schema Objects) but eventually decided not to go for it. |
Thanks also, @char0n for the data-point. |
Instead of adding "| I agree with @char0n that it's not explicitly stated in the spec that this value must be an object ("Schema Object" is a name, it's not specifying anything). Therefore, I think it's reasonable to fix this in the 3.1.1 patch rather than 3.2.0. I think it's clarifying an ambiguity, not changing a specified behavior. |
For the sake of not just adding a +1 but being on record... I agree with everything @jdesrosiers said above. |
Will replace with alternative PR on the |
It has been pointed out that we didn't achieve 100% JSON Schema compatibility with the release of OAS v3.1.0. JSON Schema allows spelling the schema
{}
astrue
and the schemanot: {}
asfalse
.These are currently allowed in subschemas, but not where our
schema
field indicates an OpenAPIschemaObject
(literally of typeobject
as expected by the metaschema for example) is allowed.This may only be of academic interest, as it is possible to spell the empty schema either as
{}
as above, or by omitting theschema
keyword entirely (where allowed), and thefalse
/not: {}
schema has limited utility at the top-level in OAS - but for the sake of spec. and tooling compatibility, here is this PR.It allows the
schema
fields to containboolean
s in the same way we used to allowschemaObject | referenceObject
in v3.0.xThis PR does not touch the metaschema as it is still somewhat in flux. I propose we pick up metaschema changes in the RC / post-release phase as with previous versions.
Edit: an alternative is to add wording similar to that we had in
v3.0.x
Signed-off-by: Mike Ralphson [email protected]