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
  • #3414
Closed
Open
Issue created Jul 22, 2019 by Administrator@rootContributor

[REQ] [Kotlin] Switch between Moshi and Jackson depending on import library

Created by: herveDarritchon

Is your feature request related to a problem? Please describe.

Currently with the Kotlin generator, there is no choice in the library used for marshalling/unmarshalling. Kotling codegen uses Moshi (may be because of the android history).

But when you use Jersey, Ktor ou Spring, you use more often Jackson than Moshi or at least Gson.

Because of this automatic import, you have to had Moshi in your build if you use codegen even if it is not really used. Moreover with Enum not respecting code convention you have runtime issue because Jackson is used to unmarshall you json string and the moshi annotation is not used. One solution is to change the template to use Jackson instead of moshi but what's happening if you use moshi in your project ?

The good thing should be to work as in Java codegen, depending on the library imported, you use Moshi annotation or Jackson or Gson.

see issue swagger-codegen 7811 (https://github.com/swagger-api/swagger-codegen/issues/7811) for more details.

Describe the solution you'd like

I'd like to be able to choose the lib for marshalling/unmarshalling imported and used by the code generated by openapi codegen

Describe alternatives you've considered

I have thought about using a specific template using Jackson but it's not a good solution for me because you're duplicating efforts.

Additional context

I'd like to make the pull request but before doing it I'd like to know if you think it is valuable for the community ;) and it can be integrated later if it works, it has the good quality :)

Assignee
Assign to
Time tracking