swagger-api / swagger-api/swagger-codegen
[csharp-dotnet2] Why QueryParams are no added as QueryParameters?
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I think that for RestSharp should be correct to Add queryParams as ParameterType.QueryString or should be use de request.AddQueryParamter() function.
Swagger declaration file content or url
csharp-dotnet2/ApiClient.mustache
Steps to reproduce
If you call to API with POST Method with QueryString, in your server application with you have generated the ApiClient project, you'll not get the query parameters. It is due to in RestSharp, the Query parameters are Get like this
Suggest a fix/enhancement
Add the queryParams in the restRequest like:
request.AddQueryParameter(param.Key, param.Value);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at modules/swagger-codegen/src/main/resources/csharp-dotnet2/ApiClient.mustache, around line 83, and inspect how query parameters are added to RestSharp requests. Reproduce a POST request with query parameters using a generated client and confirm the generated request includes them as query parameters; done means the server receives them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100