Search code examples
c#swaggeropenapiswagger-codegenopenapi-generator

How to validate the OpenAPI spec and generate C# Rest API Client?


I am trying to generate a Rest API Client using the OpenAPI spec published on the Atlassian site for the Jira cloud.

I have tried using the Swagger Codegen, Openapi-generator, and NSwag Studio. None of the auto-generated Rest API Client compiled. I have tried to generate for .Net 4.X and .Net 6 but nothing working.

Please let me know how to validate whether the OpenAPI spec is causing an issue. If that's causing the issue, is there an option to fix that OpenAPI spec and generate the Rest API Client? I prefer not to make any changes to the auto-generated code.

Thanks


Solution

  • I can generate a C# client using OpenAPI Generator 6.0.0 and compile it without issue:

    openapi-generator-cli generate -g csharp-netcore -i https://developer.atlassian.com/cloud/jira/platform/swagger.v3.json -o /tmp/jira-csharp/
    

    (openapi-generator-cli can be installed via npm: npm install -g @openapitools/openapi-generator-cli )