Open mutyasaisrikar opened 3 years ago
I fixed this issue by:
openApiGenerate {
// ...
globalProperties = [
supportingFiles: ""
]
// ...
}
and adding additional dependencies from auto-generated project gradle.build
file:
dependencies {
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-scalars:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation "io.reactivex.rxjava2:rxjava:$rx_java_version"
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
implementation ("org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"){
exclude group:'org.apache.oltu.oauth2' , module: 'org.apache.oltu.oauth2.common'
}
implementation "io.gsonfire:gson-fire:$json_fire_version"
implementation "joda-time:joda-time:$jodatime_version"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
}
But I don't like this solution. It might be a better solution to avoid generation supportingFiles
into my build.gradle
file.
with openapi-generator-maven-plugin and this option
<generateSupportingFiles>false</generateSupportingFiles>
I still get an unknown import generated in the API class files
import x.y.z.CollectionFormats.*
with openapi-generator-maven-plugin and this option
<generateSupportingFiles>false</generateSupportingFiles>
I still get an unknown import generated in the API class files
import x.y.z.CollectionFormats.*
As a workaround, you may create the empty class import x.y.z.CollectionFormats
. I did this way.
I am seeing an issue in Java for one of the fields. We have a field called ipAddress and the description in swagger is as below.
ipAddress: description: The location the content is trying to be played from type: string oneOf: [ {format: ipv4}, {format: ipv6} ]
Instead of creating it as a
String
, theopenapi-generator-maven-plugin
is creating it asOneOfAnyTypeAnyType
Also it is creating an import in API class for
CollectionFormats.*
which doesn't exist