-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[ruby] fix: explode object query parameters #24869
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| openapi: 3.0.3 | ||
| info: | ||
| title: Exploded object query parameters | ||
| description: > | ||
| Object typed query parameters, covering the four combinations of style and explode that | ||
| decide how an object is put on the wire. The free-form variants matter because a | ||
| free-form object is flagged isMap but not isContainer. | ||
| version: 1.0.0 | ||
| servers: | ||
| - url: localhost:8080 | ||
| paths: | ||
| /items: | ||
| get: | ||
| operationId: listItems | ||
| parameters: | ||
| # style and explode both left out, so the form/true defaults apply: every entry | ||
| # becomes its own parameter, keyed by the property name alone. | ||
| - in: query | ||
| name: filter | ||
| schema: | ||
| type: object | ||
| # the same, but declared as a map rather than as a free-form object | ||
| - in: query | ||
| name: typedFilter | ||
| schema: | ||
| type: object | ||
| additionalProperties: | ||
| type: string | ||
| # deepObject nests each entry under the parameter name: deepFilter[key]=value | ||
| - in: query | ||
| name: deepFilter | ||
| style: deepObject | ||
| explode: true | ||
| schema: | ||
| type: object | ||
| # form without explode keeps a single parameter carrying the whole object | ||
| - in: query | ||
| name: flatFilter | ||
| style: form | ||
| explode: false | ||
| schema: | ||
| type: object | ||
| responses: | ||
| '200': | ||
| description: a list of items | ||
| content: | ||
| application/json: | ||
| schema: | ||
| type: array | ||
| items: | ||
| type: string |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1571,7 +1571,8 @@ def test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, ur | |
| query_params[:'url'] = @api_client.build_collection_param(url, :csv) | ||
| query_params[:'context'] = @api_client.build_collection_param(context, :multi) | ||
| query_params[:'allowEmpty'] = allow_empty | ||
| query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil? | ||
| # form style explodes an object into one query parameter per entry, keyed by the property name alone | ||
| opts[:'language'].each { |name, value| query_params[name.to_s] = value } if !opts[:'language'].nil? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: The exploded entries use string keys ( Prompt for AI agents |
||
|
|
||
| # header parameters | ||
| header_params = opts[:header_params] || {} | ||
|
|
||
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.
P3: The PR description claims exploded-map collisions with other declared parameters are "handled without overwriting", but
query_params[name.to_s] = valueis a plain hash assignment that overwrites any existing entry. If a map key equals another declared query parameter's name, the value depends purely on parameter ordering in the generated method and the earlier entry is silently dropped. Either drop the collision claim or guard the assignment (e.g.query_params[name.to_s] = value unless query_params.key?(name.to_s)), keeping the explicit map entries from clobbering declared parameters.Prompt for AI agents