kokuwaio/micronaut-openapi-codegen

Generator fails when default response is used

Closed this issue · 0 comments

Related to issue #24 .

I copied the default openapi spec from https://editor.swagger.io/
And tried to build it (with the workaround applied), but got this error:

  Exception: Invalid HTTP status code: 0
        at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1082)
        at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:975)
        at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:531)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:926)
        at org.openapitools.generator.gradle.plugin.tasks.GenerateTask.doWork(GenerateTask.kt:628)
        ... 95 more
Caused by: java.lang.IllegalArgumentException: Invalid HTTP status code: 0
        at io.micronaut.http.HttpStatus.valueOf(HttpStatus.java:146)
        at org.openapitools.codegen.languages.MicronautCodegen.fromOperation(MicronautCodegen.java:209)
        at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1050)
        ... 99 more

Changing all responses: default: to responses: "200": fixes the problem.

This commit is the repository state you can use to try it out.