-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Default values #67
Conversation
7267de3
to
3290a20
Compare
3290a20
to
c1c424a
Compare
I only see this on the http://json-schema.org/latest/json-schema-validation.html#anchor10 Where emphasized word |
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. |
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.= |
@iainbeeston a test that specifies that defaults can be invalid under the schema would be reasonable sounding to me. |
c1c424a
to
f57888c
Compare
I've added some tests to ensure that an invalid default value does not cause validation to fail. |
Sorry, that was badly worded - I've re-written the tests so that they check that bad default values can never make validation fail |
Looks great, thanks! |
Default values are not required to conform to the schema they live in.
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.