-
Notifications
You must be signed in to change notification settings - Fork 67
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
Fix complex query param validation #1752
base: master
Are you sure you want to change the base?
Conversation
Generate changelog in
|
I think the clearest existing docs which support this are from ArgumentDefinition:
|
"Query parameters must be enums or primitives when de-aliased, or containers of these (list," | ||
+ " sets, optionals): 'paramName' is not allowed on endpoint 'test{http: GET /path}'"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add a test for container<enum>
to exercise the case where we recurse and the de-aliasing visitor returns Either.left
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, will add!
Before this PR
Conjure endpoint validator allows nested containers in an endpoint query argument, for example:
Query params cannot be nested container types, as container inner types must be serialized using PLAIN format, which only supports primitives + enums.
The example above in particular creates ambiguity in the wire format (since types with multiple elements are encoded to urls as a series of individual elements:
?arg=foo,arg=bar
, while optional types are simply omitted from the query string if the value is not present [docs]). In this case, an absence of the argument could be either the empty optional or a present optional with an empty list.After this PR
==COMMIT_MSG==
Conjure endpoint validator throws for nested container query arguments.
==COMMIT_MSG==
Possible downsides?