-
Notifications
You must be signed in to change notification settings - Fork 399
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
Invalid JSON is accepted by validator. #2
Comments
Erm, no, it is valid! Your schema says, for address:
Your address is a string. If you want to make one or more properties required, add "required": true to the schema of these properties. |
BTW, which version do you use? and which version of JSON Schema, too? The optional keyword no longer exists. |
Closing. Referring to an obsolete schema version. However, if you deem it important to support draft v2, I can manage that. |
Instead, just define the base checkValue() method as doig nothing, and make all ex-inheritors of SimpleSyntaxChecker inherit from SyntaxChecker.
…xChecker Make children types be an EnumSet in the constructor.
…ation It was not a good idea after all, and is more confusing than anything else.
…face And remove a now unneeded check in AbstractSyntaxChecker's .checkSyntax().
Both a single type and multipe types. I wonder whether both tests are justified...
Rename AbstractSyntaxChecker to SimpleSyntaxChecker, since this is what it really is. Also, don't make it abstract.
11 classes were just direct inheritors of SimpleSyntaxValidator, just build SyntaxValidator instances instead.
…axChecker It is now a class by itself. Make tests for it.
Validators for m{in,ax}{Length,Items} are now instantiated from PositiveIntegerSyntaxChecker. Remove classes and tests.
…class The test already existed but sported a now unneeded private class: remove it.
Same treatment for TypeKeywordSyntaxChecker and derivates.
I had the following JSON schema defined:
{
"description" : "Example Address JSON Schema",
"type" : "object",
"properties" : {
"address" : {
"title": "Street name and number",
"type" : "string"
},
"city" : {
"title" : "City name",
"type" : "string"
},
"postalCode" : {
"title" : "Zip Code: 2 letters dash five digits",
"type" : "string",
"pattern" : "^[A-Z]{2}-[0-9]{5}"
},
"region" : {
"title" : "Optional Region name",
"type" : "string",
"optional" : true
}
},
"additionalProperties" : false
}
Then I attempted to validate the following JSON, which is invalid since non-optional property "city" is missing:
{
"address" : "happy fake address"
}
But it accepted as valid.
The text was updated successfully, but these errors were encountered: