-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
[rust] fix: map-typed query parameters do not compile (.to_string() on a HashMap) #24896
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
Open
wiebren
wants to merge
1
commit into
OpenAPITools:master
Choose a base branch
from
wiebren:fix/rust-reqwest-trait-map-query-params
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
modules/openapi-generator/src/test/resources/3_0/rust/map-query-params.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| openapi: 3.0.3 | ||
| info: | ||
| title: map query params | ||
| version: 1.0.0 | ||
| paths: | ||
| /items: | ||
| get: | ||
| operationId: listItems | ||
| parameters: | ||
| - name: labels | ||
| in: query | ||
| required: true | ||
| schema: | ||
| type: object | ||
| additionalProperties: | ||
| type: string | ||
| - name: counts | ||
| in: query | ||
| schema: | ||
| type: object | ||
| additionalProperties: | ||
| type: integer | ||
| responses: | ||
| '200': | ||
| description: ok |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: A required, non-nullable map declared with
style: deepObjectfalls into this{{#isMap}}branch and is serialized as a single JSON-encoded parameter (labels={...}) instead of the deep-objectlabels[key]=valueform. The template only implements deepObject spreading inside the{{#isNullable}}branch, so required non-nullable deep-object maps bypass it. Previously this path emitted.to_string()and did not compile, so this is an incomplete fix, not a regression, but the wire format is now silently wrong for that style.Prompt for AI agents
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.
Accurate, and worth separating from this PR's scope. That branch - required, non-nullable - has never had any
isDeepObjecthandling at all: unlike the nullable and optional paths just below it, it goes straight to the scalar form for every type. So a required non-nullablestyle: deepObjectmap was not previously exploded either; it did not compile at all, which is what this PR fixes. The json encoding it now produces is the same shape the other libraries' non-primitive parameters use, so nothing regresses - but you are right that it is not the declared style.The deepObject format work lives in #24899, which routes exploded deepObject maps through
parse_deep_object(both the free-form and the typed-map shape). Extending that to the required non-nullable branch is a small addition and I am happy to push it - I would suggest doing it there rather than here, so all deepObject encoding stays in one PR and these two do not both edit the same template lines. Say which you prefer and I will add it.