Openapi-generator: NullPointerException when run "validate" with OAS2 spec

Created on 16 May 2018  路  9Comments  路  Source: OpenAPITools/openapi-generator

Description
$ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar validate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
Validating spec file (modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml)
Exception in thread "main" java.lang.NullPointerException
        at java.util.HashSet.<init>(HashSet.java:118)
        at org.openapitools.codegen.cmd.Validate.run(Validate.java:44)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:52)
openapi-generator version

Latest master

Suggest a fix/enhancement

It may caused by SwaggerConverter as the converter doesn't set message.

In case of parsing OAS3, OpenAPIDeserializer sets message.

I think that SwaggerConverter should set the message as well.

Bug Swagger-Parser

Most helpful comment

I would appreciate if you could also file an issue in the original swagger-parser project. I am open for discussion and I have opened #68 for that.

All 9 comments

I'll file the PR that fixes the issue to https://github.com/OpenAPITools/swagger-parser

I would appreciate if you could also file an issue in the original swagger-parser project. I am open for discussion and I have opened #68 for that.

This depends from swagger-api/swagger-parser#710

I changed my mind, I'll file a PR to the original swagger-parser. 馃挕

(tracking)

With #123 we use swagger-parser version 2.0.1-SNAPSHOT. This should fix this issue.

Confirmed this issue is fixed with #123 馃憤 This issue will be closed after 3.0.0 release.

Anything left to do here? or can we close this issue?

Nothing to do for this issue. 馃帀

Was this page helpful?
0 / 5 - 0 ratings