Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Kotlin] Make ApiClient in jvm-retrofit2 be able to add additional retrofit Converter.Factory #7925

Closed
shanselm-ergon opened this issue Nov 12, 2020 · 1 comment · Fixed by #9316

Comments

@shanselm-ergon
Copy link
Contributor

Description

In our project we use the openapi-generator 5.0.0-beta2 for generating our kotlin client stubs. The ApiClient offers some constructor parameters but I'm missing an option to add an additional retrofit Converter.Factory. I need this option to specify a factory, which serializes a date object as query parameter string (in our custom format, .toString() is not enough for me). In our project we use GSON as serialization library and I couldn't figure out how it is possible to set such a retrofit converter for query parameters with the currently available options.

For testing purposes I extended the generated ApiClient class with an additional constructor parameter to add our specific Converter.Factory and with this change the query parameter could successfully be serialized.

Is there already a possibility to achieve my requested behaviour with the SerializerBuilder I can pass into the class? Or is there a different approach to achieve this? What is your opinion to my described workaround?

Thank you

openapi-generator version

5.0.0-beta2

Suggest a fix/enhancement

Add an option (constructor param) to add custom retrofit converter factories. This should be optional and not break current clients.
I could create a pull request with a possible change if you wish.

shanselm-ergon added a commit to ergon/openapi-generator that referenced this issue Apr 22, 2021
shanselm-ergon added a commit to ergon/openapi-generator that referenced this issue Apr 22, 2021
wing328 pushed a commit that referenced this issue Apr 22, 2021
…onal retrofit Converter.Factory (#9316)

* [Kotlin][#7925] Add an optional Converter.Factory to the Kotlin retrofit2 ApiClient template.

* [Kotlin][#7925] Update sample project.
@shanselm-ergon
Copy link
Contributor Author

Resolved with [#9316 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant