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

chatClient…entity(Foo::class.java) in Kotlin doesn’t work with Kotlin data classes when it does work in Java records #1345

Open
joshlong opened this issue Sep 11, 2024 · 2 comments
Labels
Milestone

Comments

@joshlong
Copy link
Member

I'm afk but I got an error trying to deserialize a Kotlin data class using the ChatClient's entity(Class<T>) method

@mxsl-gr
Copy link
Contributor

mxsl-gr commented Sep 11, 2024

try register jackson kotlin module, at least it works for me.
essentially kotlin's data class compiles into a class with a full-parameter constructor. register relevant module should resolve the issue

add dependency:

<dependency>
    <groupId>com.fasterxml.jackson.module</groupId>
    <artifactId>jackson-module-kotlin</artifactId>
</dependency>

ObjectMapper register module:

OBJECT_MAPPER.registerModule(new KotlinModule.Builder().build())

@asaikali asaikali added kotlin bug Something isn't working labels Oct 30, 2024
@markpollack
Copy link
Member

Recent work in this area for kotlin support. Need to retry on latest code base.

@markpollack markpollack removed the bug Something isn't working label Nov 5, 2024
@markpollack markpollack added this to the 1.0.0-M4 milestone Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants