OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.69k stars 6.55k forks source link

[REQ] Instructions to debug opaque error message #15431

Open jzabroski opened 1 year ago

jzabroski commented 1 year ago

Is your feature request related to a problem? Please describe.

I'm trying to compare .NET's NSwag code generator for C# to OpenAPI-Generator and evaluate which one is better. OpenAPI's native support for RestSharp on the surface would seem like a clear winner.

When I run openapi-generator, I get an opaque error message that does not provide context.

I can't find "SwaggerConverter" in this project's code. I think this library is internally using this third party API code: https://github.com/swagger-api/swagger-parser/blob/e5a23e8813df1462b9f90f9e535e8da80088bfb1/modules/swagger-parser-v2-converter/src/main/java/io/swagger/v3/parser/converter/SwaggerConverter.java#L1034 - it would be helpful to know if this is the case.

The error message is:

PS D:\Users\John.Zabroski\source\openapitools> java -jar .\openapi-generator-cli.jar generate -g csharp -i bundleGroupService.json -o BundleGroupClient.cs -v [main] INFO o.o.c.config.CodegenConfigurator - VERBOSE MODE: ON. Additional debug options are injected

Describe the solution you'd like

Pointers in how to skip support and debug this problem myself.

Describe alternatives you've considered

  1. File a bug report. Bug the .json file is proprietary and behind an NDA, and it has 43,000 lines of JSON.
  2. Reach out to third party vendor with the swagger.json service causing the problem. I'd like to provide more context before doing this.

Additional context

jzabroski commented 1 year ago

I believe my immediate bad error message is due to the following rest parameter:

        {
          "name" : "_knitColumnMeta",
          "in" : "query",
          "description" : "Optional. maximum number of results that the request should return.",
          "required" : false,
          "type" : "integer",
          "enum" : [ "true", "false" ],
          "x-is-special-param" : true,
          "x-@CLASS" : "java.lang.String"
        }

I am guessing that the parser dislikes the combination of "type" : "integer" and "enum" : [ "true", "false" ]

wing328 commented 1 year ago

right, if you remove "enum" : [ "true", "false" ], that should workaround the problem before the vendor fixes the spec.

(also worth mentioning that csharp-netcore client generators support other HTTP libraries such as httpclient, generichost, unityWebRequest (e.g. via the --library option in the CLI)