-
Notifications
You must be signed in to change notification settings - Fork 350
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
Prism proxy validation failing silently when using null as value in enum array of a property #1931
Comments
@brendarearden , what's the status of this? |
I was able to reproduce this error using the following steps:
|
Is there a deadline for fixing the bug? Unfortunately, we cannot remove null from enum due to schema generation on the backend. |
@brendarearden Based on the file transferred to Swagger, a JSON-Schema is created, against which the data is validated. If the JSON-Schema is not valid (this is determined by Ajv.compile()) at the time of accessing the route, then the validation function will return an error, and then the error will be ignored. JSON-Schema may become invalid if the popular solution for enum "nullable: true" and "enum -... - null" are used together in one field (as above): This problem can be solved in different ways: At a minimum, you need:
Further:
Either/and:
Please comment on possible solutions. Is it necessary to do PR in HTTP-Spec? Which option for solving the silent error problem is closest to you? About the fact that the nullable property and enum: null can be in the same field: |
Describe the bug
When using an OAS document where we described nullable properties, we have earlier described null as value in the enum array of values(due to other library constraints..)
When validating models via prism proxy -command, that contained these enum properties it turns out that validation is not performed at all on the model, and no indication that validation was not performed is given, i.e silent fail/error.
Since the result is passed from API, via prism proxy server and back to the client without any sl-violation headers, it looks like validation has passed, while in reality it has failed or not been performed.
Also when using the --errors flag, there are no errors flagged.
When removing the null value from the enum array and keeping `nullable: true', validation is performed as expected.
To Reproduce
Expected behavior
Would expect either Prism to notify that the OAS was malformed OR that validation was not performed.
A header could be passed, indicating that validations have been performed, e.g
'sl-validation' : 'performed-succesfully'
/'sl-validation' : 'performed-errored'
Additional context
Add any other context about the problem here.
Environment:
The text was updated successfully, but these errors were encountered: