Open saurabhsjoshi opened 4 years ago
I seem to have narrowed down the issue. It appears that if you have the swagger-codegen plugin in your class path (specifically I had io.swagger:swagger-codegen:2.3.1) it results in the above error. Removing this plugin resolved the issue. Not sure if having a different plugin in the classpath should affect the functioning of this plugin so keeping the bug open.
Here is my original build.gradle configuration:
buildscript {
...
dependencies {
classpath("io.swagger:swagger-codegen:2.3.1")
classpath "org.openapitools:openapi-generator-gradle-plugin:4.2.2"
}
}
Removing the swagger-codegen solved the issue
Saurabh, you saved my day! Hitting the exact same issue and same resolution.
Bug Report Checklist
Description
Using the openapi-generator gradle plugin I setup a task to generate code for the Petstore example YAML. Checking the generated Java classes I can see this in Pet.java:
My Gradle task:
openapi-generator version
openapi-generator-gradle-plugin 4.2.2
OpenAPI declaration file content or url
URL: https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix
The fields probably need to be initialized to null at least as the generated code is invalid Java syntax. Something like