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.81k stars 6.58k forks source link

[BUG] Description Failure with no descriptive error #12738

Closed adamreed90 closed 2 years ago

adamreed90 commented 2 years ago

Attempting to generate this SDK returns a non-descript error.

Command: openapi-generator-cli generate -g csharp-netcore --additional-properties=targetFramework=net6.0 -o out -i https://raw.githubusercontent.com/team-telnyx/openapi/master/openapi/spec3.json --skip-validate-spec

Error:

Exception in thread "main" java.lang.RuntimeException: Could not generate model 'CallRequest_to'
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:536)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:892)
        at org.openapitools.codegen.cmd.Generate.execute(Generate.java:449)
        at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end 1, length 0
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
        at java.base/java.lang.String.substring(String.java:1874)
        at org.openapitools.codegen.templating.mustache.TitlecaseLambda.titleCase(TitlecaseLambda.java:64)
        at org.openapitools.codegen.templating.mustache.TitlecaseLambda.execute(TitlecaseLambda.java:80)
        at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:874)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:870)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$InvertedSegment.execute(Mustache.java:910)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:866)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:881)
        at com.samskivert.mustache.Template.executeSegs(Template.java:157)
        at com.samskivert.mustache.Mustache$IncludedTemplateSegment.execute(Mustache.java:774)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:870)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:866)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$InvertedSegment.execute(Mustache.java:910)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:881)
        at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
        at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:866)
        at com.samskivert.mustache.Template.executeSegs(Template.java:157)
        at com.samskivert.mustache.Template.execute(Template.java:134)
        at com.samskivert.mustache.Template.execute(Template.java:125)
        at org.openapitools.codegen.templating.MustacheEngineAdapter.compileTemplate(MustacheEngineAdapter.java:65)
        at org.openapitools.codegen.TemplateManager.write(TemplateManager.java:163)
        at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:1038)
        at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:1025)
        at org.openapitools.codegen.DefaultGenerator.generateModel(DefaultGenerator.java:393)
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:527)
        ... 4 more
delasource commented 2 years ago

i have the same issue.

Someone needs to implement a length check here