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

Schema validation unexpectedly succeeds when key doesn't match patternProperties and additionalProperties=false #66

Closed
smokris opened this issue Mar 13, 2017 · 5 comments

Comments

@smokris
Copy link
Contributor

smokris commented Mar 13, 2017

With this schema…

{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"type": "object",
	"patternProperties": {
		"^string[0-9]+$": {
			"type": "string"
		}
	},
	"additionalProperties": false
}

and this document…

{"foo":"bar"}

…since the key doesn't match patternProperties, and additionalProperties is false, I'd expect the document to fail schema validation. But, with wjelement-1.2, it passes:

echo 'validate patternProperties-noAdditional.jsonschema' | ./wjecli test.json
Schema validation: PASS
@penduin
Copy link
Member

penduin commented Mar 14, 2017 via email

@smokris
Copy link
Contributor Author

smokris commented Mar 14, 2017

do you happen to know if this behaviour the same with and without [regex]?

I'm not sure offhand. I confirmed that regex support is enabled for my build (I'm successfully using pattern in other parts of the schema).

@penduin
Copy link
Member

penduin commented Mar 23, 2017

Thanks for your patience and I'm sorry it took me so long to get around to this. I've pushed a fix, please try it out and let me know if I missed anything or broke something else. :^) Thanks @smokris !

@penduin penduin closed this as completed Mar 23, 2017
@penduin
Copy link
Member

penduin commented Mar 23, 2017

Also, something something Order #66. Look out Jedi!

@smokris
Copy link
Contributor Author

smokris commented Mar 24, 2017

Excellent. It's working nicely over here. Thanks, @penduin!

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

No branches or pull requests

2 participants