Add a failing test case to demonstrate a bug where inherited properties ...#38
Add a failing test case to demonstrate a bug where inherited properties ...#38kiall wants to merge 1 commit intopython-jsonschema:masterfrom
Conversation
…es are not taken into account by validate_additionalProperties.
|
I'm unsure how to go about fixing this issue in a way that will continue to work once $ref support is merged - so I've added a test case that should pass, but currently fails. |
|
Ugh I haven't looked at this carefully, but ultimately I think the thing that will happen is that as the first step in validation we'd resolve and merge all the (recursive) |
|
I'm not actually sure this is a bug. I think the schema in this test should be invalid no matter what. The main bit of the schema only allows one property, but the extends requires a different one. |
|
I think you're right, but I wasn't sure enough to say so without investigating. I know there are a few posts on |
|
We actually do this in our JS implementation, and I'm currently adding It probably won't be suitable for merging back in, but ill see if I can
|
|
Yeah, it's getting replaced in draft 4 with |
|
Here's a link to discussion of this topic: https://groups.google.com/d/msg/json-schema/Ru-tCCUlDUU/4j3mvndg2xMJ |
|
There we go :), think that's the one I caught a glimpse of. That looks convincing but I'll take another look when I get home from work. @kiall please let me know what you think as well after you've glanced at that post. |
|
I'm just trying to wrap my head around how "extends" actually means "allOf" (Or "alsoValidateAgainst" as I would have called it!). One piece that still leaves me confused is the current wording in draft-03 (and I think is unchanged in draft-04 - Do you have a authoritative link to the draft-04 spec?): This suggests to me that merging of the schemas is perfectly acceptable - but that the behavior of the merged schema should be similar to running the validation against each separately. I guess our pre-processing step will always be required so! |
|
Yeah, to merge the schemas such that the result is the same as it would be validating them separately is quite tough though. In the instance of your test case the resulting merged schema would have to be invalid for all possible json instances. There is no authoritative draft 4 yet, as it has still not been finalized. Here is the current working copy: https://github.com/json-schema/json-schema/tree/next/proposals |
Add a failing test case to demonstrate a bug where inherited properties are not taken into account by
validate_additionalProperties.