You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on a project, I discovered that I was unable to put 'allOf':[] schema defs in an inline definition. (by that I mean that I defined the schema inside the operation object).
For this particular project it is not desirable to put these definitions under the global definitions object, because it would lead to a very large definitions object that would be difficult to maintain.
Swagger-codegen version
Latest master as of June 25, 2016
Swagger declaration file
Here is a swagger file with an allOf definition in the definitions object. It generates successfully. swagger.json
Here is a near identical script, but with the allOf definition in the inline schema. It does not validate successfully. swaggerFail.json
Command line used for generation
Command line args & error message:
java -jar ~/workspace/git/vco/tools/api/swagger-codegen-cli.jar generate -i ~/git_issues/swaggerFail.json -l python -o ~/git_issues/python
[main] INFO io.swagger.parser.Swagger20Parser - reading from /home/vc/git_issues/swaggerFail.json
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /home/vc/git_issues/python/swagger_client/models/sub_model.py
[main] INFO io.swagger.codegen.DefaultGenerator - File exists. Skipped overwriting /home/vc/git_issues/python/test/test_sub_model.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /home/vc/git_issues/python/docs//SubModel.md
Exception in thread "main" java.lang.RuntimeException: Could not process operation:
Tag: default
Operation: no
Resource: post /thisDoesnt
Definitions: {sub_model=io.swagger.models.ModelImpl@80d280e4}
Exception: null
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:785)
at io.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:680)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:365)
at io.swagger.codegen.cmd.Generate.run(Generate.java:223)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:36)
Caused by: java.lang.NullPointerException
at io.swagger.codegen.DefaultCodegen.isDataTypeBinary(DefaultCodegen.java:2250)
at io.swagger.codegen.DefaultCodegen.fromParameter(DefaultCodegen.java:2233)
at io.swagger.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:1835)
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:733)
... 4 more
Steps to reproduce
Download the swaggerFail.json, and try to generate it with the command shown above.
The text was updated successfully, but these errors were encountered:
@wing328 I think this is a slightly different, but related issue. Regardless of what order I put the allOf schemas in, it will always fail unless I use a reference to point to the allOf schema itself. I just tested this by switching the model order in my swaggerFail gist. Both of these issues might be caused by the same problem though.
@rob2001 thanks for performing more tests to confirm the issue. Please define the model instead of using inline schema as a workaround for the time being.
Description
While working on a project, I discovered that I was unable to put 'allOf':[] schema defs in an inline definition. (by that I mean that I defined the schema inside the operation object).
For this particular project it is not desirable to put these definitions under the global definitions object, because it would lead to a very large definitions object that would be difficult to maintain.
Swagger-codegen version
Latest master as of June 25, 2016
Swagger declaration file
Here is a swagger file with an allOf definition in the definitions object. It generates successfully.
swagger.json
Here is a near identical script, but with the allOf definition in the inline schema. It does not validate successfully.
swaggerFail.json
Command line used for generation
Command line args & error message:
Steps to reproduce
Download the swaggerFail.json, and try to generate it with the command shown above.
The text was updated successfully, but these errors were encountered: