OpenAPITools / OpenAPITools/openapi-generator

[REQ] Instructions to debug opaque error message

Open
#15,431 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

  • [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen
  • [debugModels] prints models passed to the template engine
  • [debugOperations] prints operations passed to the template engine
  • [debugSupportingFiles] prints additional data passed to the template engine
    Exception in thread "main" java.lang.NumberFormatException: For input string: "true"
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:1134)
    at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:608)
    at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:539)
    at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:250)
    at io.swagger.v3.parser.converter.SwaggerConverter.readResult(SwaggerConverter.java:104)
    at io.swagger.v3.parser.converter.SwaggerConverter.readLocation(SwaggerConverter.java:85)
    at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
    at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:589)
    at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:647)
    at org.openapitools.codegen.cmd.Generate.execute(Generate.java:479)
    at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
    at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)

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

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 with the reported command and stack trace, then inspect CodegenConfigurator.toContext, Generate.execute, and the referenced SwaggerConverter implementation. Document how to identify the problematic input and use the available verbose debug options, with enough context for someone to investigate without the proprietary specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, tooling
Issue type
Documentation
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.