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

Default values #67

Merged
merged 1 commit into from
Nov 28, 2014
Merged

Default values #67

merged 1 commit into from
Nov 28, 2014

Conversation

iainbeeston
Copy link
Contributor

At the moment the test suite doesn't have any tests around default values. I've added a couple of tests (for draft4 and draft3) based on my understanding of how defaults should work.

@zaggino
Copy link
Contributor

zaggino commented Nov 24, 2014

I only see this on the default keyword:

http://json-schema.org/latest/json-schema-validation.html#anchor10

Where emphasized word MAY says, that this doesn't belong to the core tests.

@Julian
Copy link
Member

Julian commented Nov 24, 2014

Yeah, @iainbeeston, default isn't covered because it doesn't do anything basically. It's just for documentation, there's no validation or action that implementations are required to take.

@iainbeeston
Copy link
Contributor Author

Interesting. But slightly confusing. I can understand that title and description are for documentation purposes only, but it's less obvious for defaults (not least because defaults are values that may or may not be valid, according to the rfc).

Is there any value in updating these tests to always pass regardless of the default value, to ensure that implementations explicitly do not use defaults during validation?

Right now the Ruby implementation (json-schema) uses defaults during validation if they are defined. The tests in this pull request would pass on that implementation.=

@Julian
Copy link
Member

Julian commented Nov 27, 2014

@iainbeeston a test that specifies that defaults can be invalid under the schema would be reasonable sounding to me.

@iainbeeston
Copy link
Contributor Author

I've added some tests to ensure that an invalid default value does not cause validation to fail.

@iainbeeston
Copy link
Contributor Author

Sorry, that was badly worded - I've re-written the tests so that they check that bad default values can never make validation fail

@Julian
Copy link
Member

Julian commented Nov 28, 2014

Looks great, thanks!

Julian added a commit that referenced this pull request Nov 28, 2014
Default values are not required to conform to the schema they live in.
@Julian Julian merged commit 9208016 into json-schema-org:develop Nov 28, 2014
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.

3 participants