-
Notifications
You must be signed in to change notification settings - Fork 99
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
Impossible to define scalars for input parameters in Kotlin2 generated code #455
Comments
I had the same problem, would like to send a pr to fix this problem |
Same problem brought be here. I just copied I peeked into your PR and I think it won't be convenient. Typically in app runtime you define scalars once for the whole application. Imagine having deep and nested projection - passing scalars map to each projection would be annoying. 😅 Maybe that approach would be more welcome. |
I am using dgs-codegen successfully since a couple of months. I saw that recently a new so called kotlin2 code generation has been added and wanted to give it a try.
I have to say I really like the way the code generation works and I'd like to use it instead of the "old" kotlin code generation.
But I have one problem :)
Currently, what I am doing to call my GQL APIs is the following:
With
scalar
being amapOf(UUID::class.java to graphql.scalars.id.UUIDScalar.INSTANCE.coercing)
and this works like charm.What I would like to do, by leveraging kotlin2 implementation, is:
but when I try to do this, I get this error:
If I try it without the input parameter, it works fine, that means that somehow the return parameter is able to deserialize a UUID to String.
Digging a little bit inside the kotlin2 implementation, I see that in the Kotlin2Core.kt class there is this
private val inputSerializer = InputValueSerializer()
instantiated in the companion object that can actually be instantiated with a custom map of scalars, but it's impossible to reach from the outside. I have no control over it.My question is: would it be possible to make code generation for kotlin2 to create the code to pass a custom map of scalars as I do for the GraphQLQueryRequest in the first example? Maybe there is a way of doing it that I am not seeing?
Thanks a lot for your hard work!!
The text was updated successfully, but these errors were encountered: