-
-
Notifications
You must be signed in to change notification settings - Fork 591
additionalProperties + oneOf = does not work #193
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
Comments
It's not vague. This is how additionalProperties works it applies strictly to things that appear in properties within the current schema. You can have a look at some of the proposals for draft 5 to see some things that are meant to change this behavior. |
I was hoping you would could suggest a solution. Argumentatively (squabbling semantics), though
The definition of
That said, looking through the bug reports, the specification's creator seems quite involved with this project so I can't argue it isn't supposed to behave this way. Anyway you referenced a workaround in #167 but I can't find the sample code anywhere. I'm not sure if it was specifically for So yeah... "looking" at a proposal for draft 5, without working implementation, is like watching water boil. I don't supposed jsonschema secretly supports some of these? |
No, it doesn't "secretly support" anything. If you wanted an implementation, you'd write one, which is quite simple. Here's the sample code I referenced in that ticket, which you can find in one of the other related tickets here: #150 |
What do you think about json-schema/json-schema#151 ? |
I think you'll find @fge has a proposal that uses existing specifications to do schema merging, you might find those interesting. Personally I'm in support of those I think (at least in the 10 minutes in which he explained them to me, I haven't had much time to read the mailing list or do very much otherwise recently :/). But I'm also in support of a proposal by @geraintluff to change the default behavior of |
These problems regarding json-merge/json-patch were raised by @geraintluff
Because the json-schema/json-schema#151 proposal - lets call it "$ref extension" - works within the existing My problem with json-merge, if I understand correctly, is that it indiscriminately replaces properties of the merge source, and so wouldn't work well with the "required" property. I believe json-patch can work around this, but requires a json-patch "diff" and so is like requiring multiple I also support the proposal (which I missed) to change the default behaviour of |
Right now the only "pre processing step" so to speak is JSON Reference; this just adds one; what is more, JSON Reference still takes priority, and the merge process is defined by standards; therefore this is really a "non problem". Implementations just have to add a processing step in addition to JSON Reference...
That is wrong. Of course it has. The URI you fetched it from.
Yes, which is why I have also proposed
And I don't. This breaks backwards compatibility. Note that |
Those aren't my objections. In fact, like you, I disagree with the objections. I was just pointing out that they probably don't apply to this proposal.
Given two schemas A and B both of which define If you say, "yes, just make the user inline the
I'm a new user, I don't have to worry about backwards compatibility :) That's a joke, you make a good point. They're still drafts though. |
If you talk about JSON Patch and JSON Merge Patch, they are not; they are respectively RFC 6902 and RFC 7356.
Neither is JSON Patch. But here you talk about two independent schemas; this is not the purpose of either $merge or $patch; their intent is to apply transformations to an existing schema; nothing says that the patch to apply is a JSON Schema at all (in fact, in the $patch case they cannot be; a JSON Patch is an array). If you have two schemas to obey, you should validate against them independently! |
I was referring to JSON schema. See json-schema/json-schema#151 for the rest of the response; I'm merging these topics (they seem to be converging anyway). |
additionalProperties
does not work (does not inspect extended instances) with any of the combining schemas -allOf
,anyOf
,oneOf
- when used with properties.This is fine with
allOf
- write a pre-validation script to manually combine schemas. Not so fine withanyOf
oroneOf
.Now the specification is vague (I think, I skimmed it; it might be clarified elsewhere) as to the behaviour of
additionalProperties
. Is there a problem changing it to support combiners?The text was updated successfully, but these errors were encountered: