Description
Release 2.2.3 crashes when processing our swagger.json. The stacktrace is:
Exception: null
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:861)
at io.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:764)
at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:388)
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:700)
at io.swagger.codegen.cmd.Generate.run(Generate.java:244)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:43)
Caused by: java.lang.NullPointerException
at io.swagger.codegen.languages.AbstractJavaCodegen.needToImport(AbstractJavaCodegen.java:912)
at io.swagger.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:2219)
at io.swagger.codegen.languages.AbstractJavaCodegen.fromOperation(AbstractJavaCodegen.java:974)
at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:808)
... 5 more
Swagger-codegen version
2.2.3. This is a regression.
Swagger declaration file content or url
This is a slightly sanitized/abbreviated version of the JSON. The operation is a method that POSTs an array of string identifiers as body content. The JSON itself is being generated dynamically by an application.
"/gizmo/{gizmoId}/add-widget": {
"post": {
"operationId": "addWidgets",
"produces": [
"application/json"
],
"parameters": [
{
"name": "gizmoId",
"in": "path",
"required": true,
"type": "integer",
"format": "int64"
},
{
"in": "body",
"name": "body",
"required": false,
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
],
}
},
Command line used for generation
swagger-codegen generate -l java \
-o generated-classes --library jersey2 --invoker-package [invoker-package] \
--model-package [model-package] --api-package [api-package] \
--type-mappings "FormDataMultiPart=org.glassfish.jersey.media.multipart.FormDataMultiPart,FormDataBodyPart=org.glassfish.jersey.media.multipart.FormDataBodyPart,FormDataContentDisposition=org.glassfish.jersey.media.multipart.FormDataContentDisposition,BigDecimal=java.math.BigDecimal" \
--import-mappings "JsonNode=com.fasterxml.jackson.databind.JsonNode,InputStream=java.io.InputStream" \
-DsourceFolder=.,dateLibrary=joda
Steps to reproduce
- Run swagger-codegen. The command fails with the exception noted above.
Related issues/PRs
Possibly issue #6098.
Suggest a fix/enhancement
git bisect indicates that this crash results from changes introduced in commit d35239c.
Description
Release 2.2.3 crashes when processing our swagger.json. The stacktrace is:
Swagger-codegen version
2.2.3. This is a regression.
Swagger declaration file content or url
This is a slightly sanitized/abbreviated version of the JSON. The operation is a method that POSTs an array of string identifiers as body content. The JSON itself is being generated dynamically by an application.
Command line used for generation
Steps to reproduce
Related issues/PRs
Possibly issue #6098.Suggest a fix/enhancement
git bisectindicates that this crash results from changes introduced in commit d35239c.