You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Mutual exclusion by use of additionalProperties: false across union types #803
This spec compiles without any problem. But when validating actual request with this spec, validator fails with following error message:
RequestValidationResult(errors=[InvalidSchemaValue(value={'bar': '2',
'foo': '1'},
type='object',
schema_errors=(<ValidationError: "Additional properties are not allowed ('bar' was unexpected)">,
<ValidationError: "Additional properties are not allowed ('foo' was unexpected)">))],
body=None,
parameters=Parameters(query={},
header={},
cookie={},
path={}),
security={})
Expected Behavior
I think openapi-core should behave one of following:
Validation should be successful
Or forbid use of additionalProperties: false in context of union types (allOf) at schema lvel.
Steps to Reproduce
Validate {"foo": "-", "bar": "-"} with spec supplied above.
Mutual exclusion is not something that should be checked by validation tool. Validation tools just make sure your requirements are met. Is up to user how he design his requirements. Tools shouldn't forbid to make mutual exclusion requirement like interest > 10 and < 1
Activity
p1c2u commentedon Mar 16, 2024
Hi @segfault87 thanks for the report.
Mutual exclusion is not something that should be checked by validation tool. Validation tools just make sure your requirements are met. Is up to user how he design his requirements. Tools shouldn't forbid to make mutual exclusion requirement like
interest > 10 and < 1What you need is probably unevaluatedProperties which part of OpenAPI 3.1