-
Notifications
You must be signed in to change notification settings - Fork 50
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
Problems with top level oneOf #123
Comments
Hi, Another solution could be to name properties from all sub schemas in root schema. {
"oneOf": [
{"properties": {"a": {"type":"string", "b": {"type":"integer"}}}, "required": ["a","b"]},
{"properties": {"c": {"type":"string", "d": {"type":"integer"}}}, "required": ["c","d"]},
{"properties": {"e": {"type":"string", "f": {"type":"integer"}}}, "required": ["e","f"]}
],
"properties": {"a":{},"b":{},"c":{},"d":{},"e":{},"f":{}},
"additionalProperties": false
} Alternatively, latest JSON schema draft has a concept of |
Thanks, I was absent hence the late reply. Either setting Again I'm not sure if I'm trying something which is not right or not supported. I'm attaching a minimal example which maybe helps to see better what I want to achieve.
|
I have the following schema:
where Object1..3 extend from a base object and have a discriminator property that changes a type specific section according to its value. Currently I have the problem that despite the oneOf validation and import working correctly afterwards
processObject
is called in https://github.com/swaggest/php-json-schema/blob/master/src/Schema.php#L1204-L1206. Then the validator complains about additional properties because I set those tofalse
. If I remove that then I of course get a object back which consists only of additional properties.My question is now if the thing I try to do here is valid (in JSON Schema) and whether I'm doing something wrong. Or if the additional invokation of
processObject
should be only done as fallback if nothing else matched before.The text was updated successfully, but these errors were encountered: