swagger-api / swagger-api/swagger-codegen

[csharp-dotnet2]Missing models in codegen

Open
#10,995 1 comment 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

Generating code for csharp-dotnet2 with the latest version seems to be missing many of the models that were there in previous versions. I used Swagger Editor and SwaggerHub for code generation so I don't know exactly when this change occurred. I only know it changed between Nov 2019(when I last generated the models) and now. Both times using the same json file(OAS 2.0). For the models it does generate, any references to missing models are now replaced with a reference to the .Net "object" type instead.

Swagger declaration file content or url

Here is a gist with the before and after for file listing, an example model, and json used. Note that the example model was returning strongly typed objects before and only the "object" type after.

Command line used for generation

I used the Swagger Editor which from my understanding always uses the latest version of codegen. I've also tried this with SwaggerHub and it results in the same output.

Steps to reproduce

Upload the linked gist json file to the swagger editor and generate csharp-dotnet2 client.

Related issues/PRs

I can not find any related issues.

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

Reproduce the issue in Swagger Editor using the linked gist's OAS 2.0 JSON and the csharp-dotnet2 generator, then compare its output with the earlier model listing. Inspect the csharp-dotnet2 generation path to determine why models become .NET object references; done means the missing models are generated as strongly typed classes again.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.