swagger-api / swagger-api/swagger-codegen
[C#] Generator does not respect application/json content for GET query parameters
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I define a path in my OAS file that specifies a query parameter as a JSON array. The codegen produces multiple query parameters instead of one parameter containing the JSON array.
The generated client makes the following call:
GET https://<redacted>/file/search/?q=QueryText&types=File&types=Dir
The correct call should be:
GET https://<redacted>/file/search/?q=QueryText&types=%5B%22file%22%2C%22dir%22%5D
Swagger-codegen version
I'm using the version on SwaggerHub.
Swagger declaration file content or url
Gist of OAS: https://gist.github.com/kaburke/e44549b4e3ef31aacb117d378237b39e
Command line used for generation
SwaggerHug was used.
Steps to reproduce
- Generate C# client using the given OAS file.
- Make a call to the SearchFileSystem method.
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
Reproduce generation with the OAS gist and SwaggerHug, then inspect the generated C# SearchFileSystem method and its query-parameter serialization. Compare the current repeated types parameters with the JSON-array request shown in the issue. Done means a generated client sends one URL-encoded JSON array for the application/json query parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100