-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
[BUG] [typescript-angular] Incorrect key for query param keys #19342
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
Comments
For non-DeepObjects the parameter-name is to be discarded. You can search for |
I am currently facing a similar issue when using an array in query params:
Using SwaggerUI generated by backend works correclty, as it appends each array entry separately: But when using the TypeScript code generated by the OpenAPI Tools, I get |
@TheConstructor Attempted to implement exactly that in PR #21108. This is my first PR to this project, so hopefully I didn't miss any hoops. |
Bug Report Checklist
Description
If you generate using the option
queryParamObjectFormat=key
and have object types in your query params then they will not be added correctly. For the input{"a": "first", "b": "second"}
this will generate the url/request?a=first&b=second
while it should generate/request?params[a]=first¶ms[b]=second
.The
go
andangular-fetch
generator do seem to add the query parameters using the second method.openapi-generator version
Tested versions:
OpenAPI declaration file content or url
Generation Details
Commands used:
Steps to reproduce
typescript-angular
generatorDefaultService.getRequest()
with some object in the constructor of the app component.Related issues/PRs
This seems to be almost the same problem with but with json encoding:
#7619
Suggest a fix
The first branch here seems to cause the problem since
key
is not added as a parameter. But it is probably being omitted for a reason, but I couldn't figure out why.openapi-generator/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache
Lines 108 to 114 in 2107e9e
The text was updated successfully, but these errors were encountered: