swagger-api / swagger-api/swagger-codegen

[aspnetcore] The generated server code of petstore does not compile

Open
#8,806 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.