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

[BUG][Kotlin] Gson code in non-gson generation #20480

Open
4 of 6 tasks
sebastianblesgen opened this issue Jan 15, 2025 · 1 comment
Open
4 of 6 tasks

[BUG][Kotlin] Gson code in non-gson generation #20480

sebastianblesgen opened this issue Jan 15, 2025 · 1 comment

Comments

@sebastianblesgen
Copy link

sebastianblesgen commented Jan 15, 2025

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Please see my comment below.

Generating from IntelliJ using the following configuration leads to unexpected Gson code to be in the generated result.

I think you forgot the following conditions:
{{#generateOneOfAnyOfWrappers}}
{{#gson}}

in these files:
modules/openapi-generator/src/main/resources/kotlin-client/anyof_class.mustache
modules/openapi-generator/src/main/resources/kotlin-client/oneof_class.mustache

Before you generate the Gson based TypeAdapter.

What do you think??

Originally posted by @sebastianblesgen in #18965 (comment)

openapi-generator version

7.7.0

OpenAPI declaration file content or url
Generation Details
generateOneOfAnyOfWrappers=false
library=jvm-retrofit2
idea=true
serializationLibrary=moshi
Steps to reproduce

Using IntelliJ and generator V7 and the options specified above, I unexpectedly got some files with Gson dependencies.

Related issues/PRs

Suggest a fix

Add

{{#generateOneOfAnyOfWrappers}}
{{#gson}}
in

modules/openapi-generator/src/main/resources/kotlin-client/anyof_class.mustache
modules/openapi-generator/src/main/resources/kotlin-client/oneof_class.mustache

@sebastianblesgen sebastianblesgen changed the title [Kotlin] Gson code in non-gson generation [BUG][Kotlin] Gson code in non-gson generation Jan 15, 2025
@wing328
Copy link
Member

wing328 commented Jan 16, 2025

thanks for reporting the issue.

can you please file a PR and we will review accordingly?

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

No branches or pull requests

2 participants