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
I've encountered an inconsistency in parameter validation when using libopenapi-validator version v0.4.0. Specifically, there are differences in how validation errors are reported for different types of illegal parameter scenarios:
Enum Value Mismatch:
When providing parameter values that do not match the expected enum values, the validation error response is generated, but the ValidationError.SchemaValidationErrors field is empty.
Exceeding Maximum Range:
Conversely, when a parameter exceeds its maximum allowable value, the validation error response includes details within the ValidationError.SchemaValidationErrors field.
Upon reviewing the source code, I noticed that within the validateSimpleParam method, there is preliminary validation only for illegal values, whereas other validation types utilize the ValidateSingleParameterSchema function. This discrepancy results in the ValidationError.SchemaValidationErrors field not being populated consistently. github.com/pb33f/[email protected]/parameters/query_parameters.go:232
Suggestion:
I believe that this inconsistent behavior can make it challenging for users to handle validation errors uniformly.
It would be beneficial to use ValidateSingleParameterSchema for all types of parameter validations, ensuring that the response behavior is consistent across different scenarios.
Your feedback and thoughts on this matter would be greatly appreciated.
The text was updated successfully, but these errors were encountered:
Description:
I've encountered an inconsistency in parameter validation when using
libopenapi-validator version v0.4.0
. Specifically, there are differences in how validation errors are reported for different types of illegal parameter scenarios:Enum Value Mismatch:

When providing parameter values that do not match the expected enum values, the validation error response is generated, but the ValidationError.SchemaValidationErrors field is empty.
Exceeding Maximum Range:

Conversely, when a parameter exceeds its maximum allowable value, the validation error response includes details within the ValidationError.SchemaValidationErrors field.
Upon reviewing the source code, I noticed that within the validateSimpleParam method, there is preliminary validation only for illegal values, whereas other validation types utilize the ValidateSingleParameterSchema function. This discrepancy results in the ValidationError.SchemaValidationErrors field not being populated consistently.

github.com/pb33f/[email protected]/parameters/query_parameters.go:232
Suggestion:
I believe that this inconsistent behavior can make it challenging for users to handle validation errors uniformly.
It would be beneficial to use ValidateSingleParameterSchema for all types of parameter validations, ensuring that the response behavior is consistent across different scenarios.
Your feedback and thoughts on this matter would be greatly appreciated.
The text was updated successfully, but these errors were encountered: