Uh oh!
There was an error while loading. Please reload this page.
Allow booleans in place of any top-level schema field - #2598
Conversation
Signed-off-by: Mike Ralphson <mike.ralphson@gmail.com>
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 |
MikeRalphson
commented
Jun 2, 2021
@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 |
char0n
commented
Jun 2, 2021
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. |
MikeRalphson
commented
Jun 2, 2021
Thanks also, @char0n for the data-point. |
jdesrosiers
commented
Jun 2, 2021
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. |
Relequestual
commented
Jun 3, 2021
For the sake of not just adding a +1 but being on record... I agree with everything @jdesrosiers said above. |
MikeRalphson
commented
Jun 4, 2021
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
{}astrueand the schemanot: {}asfalse.These are currently allowed in subschemas, but not where our
schemafield indicates an OpenAPIschemaObject(literally of typeobjectas 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 theschemakeyword 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
schemafields to containbooleans in the same way we used to allowschemaObject | referenceObjectin 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.xSigned-off-by: Mike Ralphson mike.ralphson@gmail.com