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

Add test-case for default. default should obviate require #139

Closed
wants to merge 1 commit into from

Conversation

pipobscure
Copy link

The tests for default are incorrect.

The specification Section 6.2 states:

There are no restrictions placed on the value of this keyword.
This keyword can be used to supply a default JSON value associated with a particular schema. It is RECOMMENDED that a default value be valid against the associated schema.
This keyword MAY be used in root schemas, and in any subschemas.

While this means that are no limits on the value of default, the presence of this keyword has other implications. One of them is the fulfilment of the required keyword.

If the schema as presented in this pull-request is not valid, then there is no purpose for the default. Whether this is implemented by modifying the original document (which would go against the intent of pure validation) or by simply modifying the validation can be up to the implementation. However this schema as presented should be valid by any compliant implementation

@pipobscure
Copy link
Author

this is also referenced in an issue on the specification

@Julian
Copy link
Member

Julian commented Dec 25, 2016

The interpretation you have isn't impossible, but it's not the one intended by draft 3 and 4. The tests are correct as is, and default basically is just for documentation purposes. I'd encourage you to lobby in the schema repository if you feel the behavior should be changed for draft 6 though.

Personally while in isolation I agree with the current (draft 4) behavior, I think that in all draft 4 gives new users lots of stumbling blocks on validators that end up just being for documentation.

@Julian Julian closed this Dec 25, 2016
@handrews
Copy link
Contributor

I think that in all draft 4 gives new users lots of stumbling blocks on validators that end up just being for documentation.

@Julian I'm kind of hoping we split the annotation keywords out into a full documentation vocabulary as suggested for json-schema-org/json-schema-spec#136

@Julian
Copy link
Member

Julian commented Dec 25, 2016

@handrews cool, that looks like a promising issue!

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

Successfully merging this pull request may close these issues.

4 participants