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

Not able to generate builder classes in Kotlin #43

Closed
saitejdandge opened this issue Aug 17, 2022 · 2 comments
Closed

Not able to generate builder classes in Kotlin #43

saitejdandge opened this issue Aug 17, 2022 · 2 comments

Comments

@saitejdandge
Copy link

Plugin is not generating builder classes when the selected language is Kotlin, is there a way around this.

@deweyjose
Copy link
Owner

Hi, will take a look tomorrow.

@deweyjose
Copy link
Owner

Hi @saitejdandge

I did some research with version 1.22 of the plugin.

If you want to use the Builder pattern for your generated types you'll need to add the following to your plugin configuration block to trigger the DGS kotlin2 codepath:
<generateKotlinNullableClasses>true</generateKotlinNullableClasses>

Client Generation
It looks like the client types are generated as Java, except for Entities, even if you've selected Kotlin.
You can generate Kotlin client types by setting the following in your configuration block.
<generateKotlinClosureProjections>true</generateKotlinClosureProjections>.

Please keep in mind this plugin is a thin wrapper over the Netflix DGS codegen project to support the maven based community.

If you're curious this is the code that's actually generating the types:
https://github.com/Netflix/dgs-codegen/blob/5c89523dd90b645746ed73ab7c873412d34624b9/graphql-dgs-codegen-core/src/main/kotlin/com/netflix/graphql/dgs/codegen/CodeGen.kt#L293

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