swagger-api / swagger-api/swagger-codegen
Broken C# generated using swagger spec
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Q&A
- OS: Windows 10 (21H2)
- Browser: Microsoft Edge
- Version: 108
- Method of installation: N/A - editor.swagger.io
- Swagger-Editor version: latest as of post (no idea where it shows this)
- Swagger/OpenAPI version: latest as of post (no idea where it shows this)
Content & configuration
Example Swagger/OpenAPI definition:
https://sellerapi.kaufland.com/swagger.json
Swagger-Editor configuration options:
Default settings
?_ga=2.158309177.205868905.1671524195-1419130726.1669876810
Describe the bug you're encountering
Generates broken C#
- Comment lines in XML documentation do not start with // when there's a new line in param node (e.g. ln 199 \src\IO.Swagger\Api\ProductDataApi.cs)
- Null default value assignment to non-nullable types (enums) (e.g. ln 1253 \src\IO.Swagger\Api\ProductDataApi.cs)
- Inheritance of unknown types Integer, LongInteger (e.g. ln 30 \src\IO.Swagger\Model\AllOfOrderDetailsOrderUnitsDeliveryTimeMin.cs)
- Inheritance of enums (e.g. ln 30 src\IO.Swagger\Model\AllOfTicketTopic.cs)
- Probably more, Visual Studio not showing all errors
To reproduce...
Steps to reproduce the behavior:
- Generate regular C# client on editor.swagger.io with default settings using swagger spec: https://sellerapi.kaufland.com/swagger.json
- Open solution and observe mountain of errors
Expected behavior
Valid C#
Screenshots




Additional context or thoughts
-
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 generation from the linked sellerapi.kaufland.com/swagger.json with the default editor.swagger.io settings. Inspect the generated ProductDataApi.cs and the AllOfOrderDetailsOrderUnitsDeliveryTimeMin.cs and AllOfTicketTopic.cs models for the reported documentation, nullability, unknown-type, and enum-inheritance errors. Done means the generated C# solution builds without these errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100