-
Notifications
You must be signed in to change notification settings - Fork 21
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
Incomplete discriminator support ? #76
Comments
Hi, that's very hard to resolve AFAIR, probably a lot of refactoring should be made, I don't have time for that. Honestly, I don't think it is so important to put the effort into it. |
Hello, Sadly that's what I guessed :/ Regards, Adam. |
Unfortunately, it won't happen, like 95% :) It is not only hard to implement, but it is not obvious what error to display, for example, you have Regarding middleware - it is not possible as well, there's no way to get the schema from available request and handler from middleware. So, there's only one way is disable validation for this route and parse it in the handler itself. |
For the first case, if a discriminator is set you may just return that provided discriminator value must be one of the configured values. That's exactly the path I took, I currently generating marshmallow models from the OpenAPI spec and implementing my own validation. |
Hello hh,
When using oneOf + discriminator, the OpenAPI spec is supposed to provide a hint to aiohttp-swagger3 on which schema should be chosen to validate provided payload. If so, I expect to receive a proper validation error related to the chosen models, but all I get is "failed to validate oneOf".
Here is an example script reproducing the issue: when POSTing on type1 or type2 route I get an helpful error message, when using the polymorphic route, I don't get any hint.
I am not sure this is actually easy to solve, as if I understood correctly you are relying on fastjsonschema library but that would definitely be a major improvement for API users ;-)
Best regards, Adam.
The text was updated successfully, but these errors were encountered: