swagger-api / swagger-api/swagger-codegen

Swagger c# generation fails

Open
#7,755 2 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

When sending the swagger json to https://generator.swagger.io/api/gen/clients/csharp
we get ;
Fri Mar 02 2018 16:48:49.0412 [ERROR] TID: 9 GenerateCsharp ; StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, DELETE, PUT
Access-Control-Allow-Headers: Content-Type
Connection: close
Date: Fri, 02 Mar 2018 16:48:47 GMT
Server: Jetty(9.2.9.v20150224)
Content-Length: 106
Content-Type: application/json
}

Swagger-codegen version

not sure - current live on website

Swagger declaration file content or url

https://gist.github.com/jemprince/a73026aee1eadb8d09c12fecbe65b63b

Command line used for generation
Steps to reproduce

codeGenPath="https://generator.swagger.io/api/gen/";
...
using (var client2 = this.iClientWithProxy.Create())
{
client2.BaseAddress = new Uri(codeGenPath);
client2.DefaultRequestHeaders.Accept.Clear();
client2.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            using (var request = new HttpRequestMessage(HttpMethod.Post, genPath))
            {
            request.Content = new StringContent(swaggerSpec, Encoding.UTF8, "application/json");

...
(swaggerSpec as above)

Related issues/PRs

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 400 response at https://generator.swagger.io/api/gen/clients/csharp with the supplied Swagger JSON and identify which part of the declaration the service rejects. Done means the same declaration is accepted and a C# client is generated; the issue does not name a repository file or test to run.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.