Closed raphaeldelio closed 4 months ago
I'm not very familiar with Kotlin at this level. Is the fix you suggest to add mapper.registerModule(JavaTimeModule())
the JavaTimeModule
to the object mapper used in the BeanOutputParser
?
I believe this is not an issue and can be closed. BeanOutputParser
can accept a provided ObjectMapper
(see here). We just need to customize an ObjectMapper
and use it with BeanOutputParser
. For example, we can do this:
val parser = BeanOutputParser(TopSong::class.java, ObjectMapper().findAndRegisterModules())
Thanks for the feedback, closing
Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create. If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description When using BeanOutputParser with Kotlin Data Classes, an exception is thrown.
When using jackson it works just fine:
Environment Spring AI 0.8.0-SNAPSHOT Kotlin 1.9.22
build.gradle.kts
Steps to reproduce Steps to reproduce the issue.
Expected behavior I expect the JSON to be deserialized into the Bean
Minimal Complete Reproducible example Please provide a failing test or a minimal complete verifiable example that reproduces the issue. Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.