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
Custom types are not replaced with values from customTypeMapping #1987
Comments
@martinbonnin do you think if this issue can be related to the gradle plugin? |
@sav007 it could be. I've seen such issues in the past. It was because a gradle I've added a test there: #1991. But it seems to behave as expected. @ahar, |
Hello @martinbonnin ! re: gradle version
By the way, I found there is new version 1.3.1. Updated to 1.3.1 - the same thing. Thank you for diving in! |
Can you try setting
I would actually expect |
@martinbonnin I've tried. Works like a charm. |
That's definitely a weird behaviour. I'll try to dig a bit more see what we can do. |
@martinbonnin Looking at you suggestion of putting I get I'm using Is there a way around this? |
@mos8502 yep, looks like this putting it in The solution is to use apollo {
generateKotlinModels.set(true)
service("api") {
customTypeMapping.set(mapOf("BigDecimal" to "java.math.BigDecimal"))
sourceFolder.set("$projectDir/src/main/graphql/api")
rootPackageName.set("com.web.bff.queries.api")
suppressRawTypesWarning.set(true)
}
} |
@martinbonnin unfortunately even if I define |
Sorry might have missed to use set instead of put 🤔 |
@martinbonnin using |
Can you use different package names for your different services? The layout should look like:
|
Also it's very unlikely that all your services need the exact same |
There are three distinct schemas in my case but the customTypeMapping is the same for all. But regardless the issue is that CustomTypes is generated in the same package in a single gradle module |
You can control the location of |
@martinbonnin the schemas were in different subdirectories, With new version that I'm integrating this doesn't seem to be the case anymore. Adding Thanks for all the help |
Summary
I try to use code generation via apollo gradle plugin. CustomType.kt generates, have all CustomType in it, but not get replaced from customTypeMapping values even if I attach adapter.
Description
I use apollo gradle plugin on server application built with spring boot.
I have multiple schema files and multiple queries.
I have configuration in my build.gradle.kts:
I put custom adapter for my apolloclient for service "api":
And I apollo plugin generated the code for CustomType.kt:
As you can see, BigDecimal is kotlin.Any, however in config I said:
customTypeMapping.put("BigDecimal", "java.math.BigDecimal")
However, ID is kotlin.String
Any help is much appreciated.
Version
Plugin version I use is 1.3.0
The text was updated successfully, but these errors were encountered: