swagger-api / swagger-api/swagger-codegen
[C#] Invalid code produced for Multipart File with json generated by springdoc
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I have a Spring Boot REST Api that is using springdoc-openapi to generate the json file.
I have then tried to generate a client for this api with swagger-codegen version 3.0.22 and latest commit from the 3.0.0 branch and both produced invalid code.
The problem is for an endpoint that wants a file. swagger-codegen uses a variable named _file in the body of the corresponding methods but does not declare it as a parameter of the method, the variable then stays undeclared.
The problem could either be in swagger-codegen itself or my usage of springdoc.
Swagger-codegen version
Version 3.0.22 and reproduced with latest commit from 3.0.0 branch (ad1b8bb54ce5eb1677426b5a49e80102590badc1)
Swagger declaration file content or url
https://gist.github.com/LelouBil/cf5171e879c1003216b1e70ae5c61c5d
Command line used for generation
"java.exe","-jar swagger-codegen-cli.jar generate -i http://localhost:8080/v3/api-docs -l csharp -o output
Steps to reproduce
This example project has the same problem
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 with swagger-codegen 3.0.22 or the 3.0.0 branch using the linked springdoc-generated OpenAPI document, the DemoSpringApp.zip example, and the csharp generator command. Inspect the C# generator entry points and templates for the multipart file endpoint; done means the generated methods declare every referenced file variable and produce valid C#.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, openapi, spring-boot
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100