-
-
Notifications
You must be signed in to change notification settings - Fork 222
oneOf with (additionalProperties: false) and (validateResponses: removeAdditional setting) does not work as expected #740
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
Looking further into ajv docs https://ajv.js.org/guide/modifying-data.html#removing-additional-properties it looks like this is expected behavior. So I tried this also with the suggestion of adding discriminator property but still seeing same behavior. |
I am running into the same issue here and after some debugging, I find that |
Same issue here |
Same here |
Seems like a lot of these problems are due to the OpenAPI spec itself simply does not support using From other discussion it seems this is fixed by the Seems like this PR will fix it |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
It looks like removeAdditional: "failing" response validation fails. I feel like the validator first tries to validate against type A and in progress removes property "extra", then it passes this to validate against B and it now also fails since "extra" field is missing. Note that the schema works if I change the order of TypeA and TypeB in the oneOf property.
To Reproduce
I've added a test case that fails in my fork of this repo, link to commit:
vileanco@1963bd6
Actual behavior
Response validation fails with 500 "Internal server error". Errors returned
Expected behavior
Response validation should pass.
Examples and context
Validator options:
Spec:
The text was updated successfully, but these errors were encountered: