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

kotlinx.serialization not used for serializing collections #27232

Closed
dellisd opened this issue Jul 30, 2021 · 5 comments
Closed

kotlinx.serialization not used for serializing collections #27232

dellisd opened this issue Jul 30, 2021 · 5 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) theme: kotlin An issue related to Kotlin support

Comments

@dellisd
Copy link

dellisd commented Jul 30, 2021

Affects: 5.3.9


With kotlinx.serialization and Jackson (because of actuator) on the classpath, if a collection such as a List<T> is serialized as the response, Jackson will be used instead of kotlinx.serialization. This can cause problems if using @SerialName since Jackson will ignore those.

This only applies if the collection itself is intended to be the response body, so if a @Serializable class contains a collection it will still be serialized normally using kotlinx.serialization.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 30, 2021
@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Nov 12, 2021
@xuanswe
Copy link

xuanswe commented Jan 15, 2023

If I understand correctly, even if we configure to use kotlinx.serialization, Spring still needs Jackson in dependencies.

Could someone please explain why? when Jackson must be used instead of kotlinx? and how to check which one is using?
Is there a plan to completely remove Jackson if using kotlinx?

Currently, if I remove Jackson and return a List<String>, I will get 406 Not Acceptable error.

Sorry for too many questions.

@sdeleuze sdeleuze self-assigned this Jan 16, 2023
@sdeleuze sdeleuze added the theme: kotlin An issue related to Kotlin support label Jan 16, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented Feb 8, 2023

Hi, sorry for the delay.

Based on kotlinx.serialization source code, I would expect serialization work as expected with List and Collection (not Iterable) of generic types annotated by @Serializable.

If you are trying to serialize a thitrd party interface, you may be blocked by Kotlin/kotlinx.serialization#2060 but that one is not on Spring side.

Could you please provide a repro?

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Feb 8, 2023
@xuanswe
Copy link

xuanswe commented Feb 11, 2023

@sdeleuze thanks for pointing to the relevant ticket!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 11, 2023
@sdeleuze sdeleuze added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Feb 12, 2023
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Feb 19, 2023
@spring-projects-issues
Copy link
Collaborator

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

@spring-projects-issues spring-projects-issues closed this as not planned Won't fix, can't repro, duplicate, stale Feb 26, 2023
@spring-projects-issues spring-projects-issues removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) theme: kotlin An issue related to Kotlin support
Projects
None yet
Development

No branches or pull requests

5 participants