-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
-
[Optional] Bounty to sponsor the fix (example)
Description
In the API templates for Retrofit2 with Play framework, api.mustache,
retrofit2.Response is imported but it is conflicted with the definition
of the response defined inline in the responses section and it does not
refer to the external definition by "ref" pointer. This causes the
compilation errors since the generated code are imported before
retrofit2.Response and they do not get along with the definition of
Retrofit2's Response class.
openapi-generator version
$ ./openapi-generator-cli.sh version
4.2.3
OpenAPI declaration file content or url
https://support.sigfox.com/api/apidocs
Command line used for generation
$ cat config.json
{
"apiPackage":"com.example.openapi.client.api",
"artifactId":"sample-openapi-client",
"artifactVersion":"0.1.0",
"dateLibrary": "java8",
"groupId":"com.example",
"hideGenerationTimestamp": true,
"invokerPackage":"com.example.openapi.client.invoker",
"java8": true,
"library":"retrofit2",
"modelPackage":"com.example.openapi.client.model",
"playVersion": "play26",
"serializationLibrary": "jackson",
"usePlayWS": true
}
$ ./openapi-generator-cli.sh generate -i https://support.sigfox.com/api/apidocs -g java -c config.json -o tmp
Steps to reproduce
$ cat > config.json <<EOF
{
"apiPackage":"com.example.sigfox.client.api",
"artifactId":"sigfox-api-client",
"artifactVersion":"0.1.0",
"dateLibrary": "java8",
"groupId":"com.example",
"hideGenerationTimestamp": true,
"invokerPackage":"com.example.sigfox.client.invoker",
"java8": true,
"library":"retrofit2",
"modelPackage":"com.example.sigfox.client.model",
"playVersion": "play26",
"serializationLibrary": "jackson",
"usePlayWS": true
}
EOF
$ ./openapi-generator-cli.sh generate -i https://support.sigfox.com/api/apidocs -g java -c config.json -o tmp
$ cd tmp
$ chmod +x ./gradlew
$ ./gradlew build
The compilation in the last step fails with compile errors.
Related issues/PRs
None
Suggest a fix
I made a patch and I'm wiling to make a PR with it if this issue got accepted.