swagger-api / swagger-api/swagger-codegen
[aspnetcore] The generated server code of petstore does not compile
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Issue is this: Code generated is:
[EnumMember(Value = available)]
Correct code is this (quotes added):
[EnumMember(Value = "available")]
Swagger-codegen version
Online tool https://generator.swagger.io/
Swagger declaration file content or url
http://petstore.swagger.io/v2/swagger.json
Command line used for generation
GEN -> Server
Selected aspnetcore and petstore json
Steps to reproduce
Compiler error
Related issues/PRs
Suggest a fix/enhancement
Providing fixed petstore code (please rename *.txt to *.cs files)
Pet.txt
Order.txt
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 by reproducing the server generation with the petstore Swagger JSON through the online generator, selecting aspnetcore. Compare the generated EnumMember attributes with the attached Pet.txt and Order.txt examples, focusing on the missing quotes around available. Done means the generated ASP.NET Core server code compiles with correctly quoted enum values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100