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

Fix default usage in meta-schemas #611

Merged
merged 2 commits into from
Jun 30, 2018

Conversation

handrews
Copy link
Contributor

With default values now having implication for both assertions
and annotation collection (see PR #600 for this), it no longer
makes sense to have a default value for subschemas.

Keywords such as additionalProperties now collect annotation
information based on the instance properties to which thier
subschema(s) are applied. This means that a subschema of true
will cause a property to appear in the annotation, while an
absent subschema will not. Therefore, a default of true does
not match the annotation collection behavior and is not accurate.

Additionally, as written this has always been problematic, as
it claims a default true value for not, which would in fact
cause all schemas without not to fail.


However, the Hyper-Schema LDO schema keywords do have
reasonable defaults:

A resource is assumed to provide or accept any structure as its
representation, accept any structure for processing if it does processing
at all, and to allow any header usage. So targetSchema, submissionSchema,
and headerSchema all default to true.

However, by default, URI templates may not be resolved from input,
so headerSchema defaults to false.

handrews added 2 commits June 16, 2018 20:04
With default values now having implication for both assertions
and annotation collection, it no longer makes sense to have
a default value for subschemas.

Keywords such as "additionalProperties" now collect annotation
information based on the instance properties to which thier
subschema(s) are applied.  This means that a subschema of true
will cause a property to appear in the annotation, while an
absent subschema will not.  Therefore, a default of true does
not match the annotation collection behavior and is not accurate.

Additionally, as written this has always been problematic, as
it claims a default true value for "not", which would in fact
cause all schemas without "not" to fail.
While it no longer makes sense to have a universal default schema
value (see previous commit), the LDO schema keywords have specific
implications which do match one or the other boolean schema.

This commit adds the appropraite one.  By default, a resource is
assumed to provide or accept any structure as its representation,
accept any structure for processing if it does processing at all,
and to allow any header usage.  So targetSchema, submissionSchema,
and headerSchema all default to true.

However, by default, URI templates may not be resolved from input,
so headerSchema defaults to false.
@handrews handrews added this to the draft-08 milestone Jun 17, 2018
@handrews handrews requested review from awwright, dlax and a team June 17, 2018 03:28
@handrews handrews merged commit a2c6b1c into json-schema-org:master Jun 30, 2018
@handrews handrews deleted the meta-default branch December 17, 2018 02:44
@gregsdennis gregsdennis added clarification Items that need to be clarified in the specification and removed Type: Maintenance labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Items that need to be clarified in the specification core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants