-
Notifications
You must be signed in to change notification settings - Fork 317
Support for Kotlin inline value classes #1186
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
Comments
Can you explain the difference with #1163 please? |
@bclozel I don't think the issues are related. While both are related to constructors and Kotlin, this issue is about the use of value classes while the existing issue is about using a constructor for only some properties and setters for others. A fix for #1163 might provide a workaround for value classes but I'm not entirely sure. |
Rather than pointing to other PRs, can you share a code snippet or a minimal reproducer? |
I've narrowed this down to a problem in Spring Framework. I've opened spring-projects/spring-framework#34760 There are many subtle issues with Kotlin<->Java reflection and I'm not sure this use case will be supported in Spring for GraphQL 1.x. We might wait for broader support in Spring Framework 7.0 with spring-projects/spring-framework#33630 |
Thanks for looking into this so quickly. I'm looking forward to broader support in Spring Framework 7.0. |
Currently, Spring for GraphQL does not work with Kotlin inline value classes. When these are used as field types, I have noticed two issues:
@JvmName
or explicit names with@SchemaMapping
.DefaultConstructorMarker
which the Kotlin compiler adds to the constructor's signature. I have not found any workaround for this to make this work with Spring for GraphQL.Spring Data already already supports value classes since version 3.2. It would be great if Spring for GraphQL would support them too, so they can be used throughout the whole Spring stack.
Related Spring Data PR: spring-projects/spring-data-commons#2866
Related Spring Data docs: https://docs.spring.io/spring-data/commons/reference/object-mapping.html#mapping.kotlin.value.classes
Exception when constructor binding with a value class:
The text was updated successfully, but these errors were encountered: