-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
express-openapi-validator
does not support explode: false
for query parameters
#917
Closed
Gituar opened this issue
May 21, 2024
· 1 comment
· Fixed by #951, #960 or #1008 · May be fixed by i3-Market-V3-Public-Repository/SP3-SCGBSSW-CR-ConflictResolverService#23 or i3-Market-V3-Public-Repository/SP3-SCGBSSW-CR-ConflictResolverService#24
Closed
express-openapi-validator
does not support explode: false
for query parameters
#917
Gituar opened this issue
May 21, 2024
· 1 comment
· Fixed by #951, #960 or #1008 · May be fixed by i3-Market-V3-Public-Repository/SP3-SCGBSSW-CR-ConflictResolverService#23 or i3-Market-V3-Public-Repository/SP3-SCGBSSW-CR-ConflictResolverService#24
Comments
dusanmi
pushed a commit
to dusanmi/express-openapi-validator
that referenced
this issue
Jun 24, 2024
Proposed fix #935 |
cdimascio
pushed a commit
that referenced
this issue
Aug 4, 2024
This was referenced Aug 26, 2024
This was referenced Sep 13, 2024
This was referenced Sep 15, 2024
This was referenced Nov 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The express-openapi-validator library does not properly support query parameters with
explode: false
as specified in the OpenAPI 3.0.3 specification. This causes validation errors for parameters that should allow reserved characters or have specified patterns and minimum lengths on the array items.To Reproduce
Steps to reproduce the behavior:
explode: false
and additional constraints such aspattern
andminLength
on the items.test=categoryId%3AIN%3A%5B1%2C2%2C3%2C4%2C5%5D,itemId%3AEQ%3A2
containing reserved characters and ensuring the values match the defined pattern and length requirements.Actual behavior
Validation errors occur for the parameter:
Parameter 'test' must be URL encoded. Its value may not contain reserved characters.
must match pattern "^[a-zA-Z0-9]+:(EQ|IN)(:.+)?$"
must NOT have fewer than 5 characters
Expected behavior
The library should properly handle array query parameters with
explode: false
:Examples and context
Example OpenAPI specification snippet:
If
allowReserved: true
is set on the array in the OpenAPI specification, themust be URL encoded
error is bypassed. However, themust match pattern
error persists even though the parameter value is URL encoded and should match the pattern when decoded. It seems that the express-openapi-validator URL decodes the parameter value too soon, leading to this mismatch.Example stack trace:
OpenAPI 3.0 introduced support for
style
andexplode
keywords for parameter serialization, including arrays and objects in query parameters (Parameter Serialization) (A Guide to What’s New in OpenAPI 3.0).The default serialization method for query parameters is
style: form
andexplode: true
. Usingexplode: false
changes the serialization format, which should be properly handled by the validator (Describing Parameters) (OpenAPI Specification v3.0.3).The text was updated successfully, but these errors were encountered: