-
Notifications
You must be signed in to change notification settings - Fork 12
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
Schema composition breaks with additionalProperties: false #51
Comments
I discovered this as well, and it is more of an issue with OAS than express-openapi-validate.
|
I agree this might not be an issue with express-openapi-validate, just opening up the discussion here, happy to move it elsewhere. Tried your solution, but it did not resolve the issue. Using your suggestions:
...now results in:
|
If you remove the additionalProperties in the Pet schema, it will no longer complain about bark. Specifying that in Pet conflicts with the set of properties in the Dog schema. |
That's correct, but then |
True. Workaround would be to have Pet remain "generic" -- only used as ref by other types, which specify additionalProperties: false, and are the ones actually used. I.e., specify this:
and then use PetConcrete for the /simple request body type, not Pet. |
Confirmed that your workaround along with @keepersmith's change does work, for better or worse. Updated openapi.yaml below.
|
Schema composition doesn't appear to work with
additionalProperties: false
.openapi.yaml
Simple schema
/simple
with the following works as expected.foo
in the request......returns an error as expected because
additionalProperties: false
is set on thePet
schema.Complex schema with composition
On the other hand, hitting
/complex
with the following......returns an unexpected error.
The text was updated successfully, but these errors were encountered: