Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5598
Closed
Open
Issue created Mar 16, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] [Java] [Retrofit2] [Play] Fix Retrofit2 templates for Play framework to use fully qualified package name

Created by: tfukushima

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.

https://github.com/tfukushima/openapi-generator/commit/42e3c4144cca8d9a980c5f29fd181f5c898e22cc

Assignee
Assign to
Time tracking