Open JDziurlaj opened 6 years ago
Facing the same issue. Any suggested fix / solution available for this?
Experiencing this error as well.
Same problem. I'm using swagger v3.0.3 to generate client sdk for https://github.com/strongloop/loopback4-example-shopping. It works fine with swift 4, typescript-angular. But when it generates code to kotlin-client and java, it shows an error:
Exception in thread "Thread-1" java.lang.RuntimeException: Could not process model 'inline_response_200'.Please make sure that your schema is correct! at io.swagger.codegen.v3.DefaultGenerator.generateModels(DefaultGenerator.java:354) at io.swagger.codegen.v3.DefaultGenerator.generate(DefaultGenerator.java:719) at io.swagger.codegen.v3.cli.cmd.Generate.run(Generate.java:342) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to io.swagger.v3.oas.models.media.Schema at io.swagger.codegen.v3.generators.kotlin.AbstractKotlinCodegen.getTypeDeclaration(AbstractKotlinCodegen.java:275) at io.swagger.codegen.v3.generators.DefaultCodegenConfig.fromProperty(DefaultCodegenConfig.java:1621) at io.swagger.codegen.v3.generators.DefaultCodegenConfig.addVars(DefaultCodegenConfig.java:2917) at io.swagger.codegen.v3.generators.DefaultCodegenConfig.addVars(DefaultCodegenConfig.java:2888) at io.swagger.codegen.v3.generators.DefaultCodegenConfig.addVars(DefaultCodegenConfig.java:2876) at io.swagger.codegen.v3.generators.DefaultCodegenConfig.fromModel(DefaultCodegenConfig.java:1345) at io.swagger.codegen.v3.DefaultGenerator.processModels(DefaultGenerator.java:951) at io.swagger.codegen.v3.DefaultGenerator.generateModels(DefaultGenerator.java:349) ... 3 more
https://www.dropbox.com/s/rg5c8pgw7jn2dcd/openapi2.json?dl=0 here is openapi.json file in case someone needs to reproduce the error.
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \ -i http://localhost:3000/openapi.json \ -l kotlin-client \ -o samples/client/shopping/kotlin-client
It seems like swagger has a problem with boolean type. When I wrap all boolean value(true, false) in strings (like true -> "true", false -> "false"), it can generate code, but it's not as I want. For example: required: true, so if I change true -> "true", this field is not required. Do you have any ideas to fix this problem?
Isn't that solved with the last releases now?
Description
I'm running into an issue where
swagger-codegen
fails to generate files for any generation target when referencing an external schema, with a variant of the following errorI have no concerns that my external schemas are valid,
swagger-editor
is able to parse and generate documentation for them, they pass JSON schema validation tools, etc.This schema is quite complex, and I wish I had a simpler example to give you, but I do not. However, I've linked the schemas and OpenAPI file to this issue.
Swagger-codegen version
3.0.0-SNAPSHOT. Regression status unknown. Has always been a 3.0.0 target.
Swagger declaration file content or url
gist linked schema 1 linked schema 2
Command line used for generation
java -jar swagger-codegen-cli.jar generate -i vri.yaml -l java -o ./
Steps to reproduce
Run command found in
Command line used for generation
Related issues/PRs
None.
Suggest a fix/enhancement