Skip to content
This repository was archived by the owner on Nov 30, 2025. It is now read-only.

feat: accept single value as list#721

Open
WhiredPlanck wants to merge 1 commit intocharleskorn:mainfrom
WhiredPlanck:single-value-as-list
Open

feat: accept single value as list#721
WhiredPlanck wants to merge 1 commit intocharleskorn:mainfrom
WhiredPlanck:single-value-as-list

Conversation

@WhiredPlanck
Copy link
Copy Markdown

(I connot run the test for "No JDK specified" exception, even I've specified, sorry)

@stale
Copy link
Copy Markdown

stale Bot commented Aug 27, 2025

This issue has been automatically marked as stale because it has not had any activity in the last 60 days. It will automatically be closed if no further activity occurs in the next seven days to enable maintainers to focus on the most important issues.
If this issue is still affecting you, please comment below within the next seven days.
Thank you for your contributions.

@stale stale Bot added the stale label Aug 27, 2025
@stale stale Bot removed the stale label Aug 29, 2025
@WhiredPlanck
Copy link
Copy Markdown
Author

I manage to run the tests, all yaml reading tests are passed.

图片

@charleskorn Would you like to have a look?

@charleskorn
Copy link
Copy Markdown
Owner

charleskorn commented Aug 30, 2025

Is there a reason why this needs to be implemented in Kaml rather than implemented as a custom serializer in your application?

@WhiredPlanck
Copy link
Copy Markdown
Author

WhiredPlanck commented Aug 30, 2025

Is there a reason why this needs to be implemented in Kaml rather than implemented as a custom serializer in your application?

My original intention to do this is to implement the same feature as Jackson. There are many "single values" I need to accept them as list in the data I want to deserialize. Some data are cloned from upstreams and I connot control the format. And If I want to deserialize a field as Map<String, List<String>, things seem to be complex to do with a custom serializer.

UPDATE: YAML 1.2 specification does not allow it, but many parsers (such as Jackson) support it as a convenience feature that can be manually enabled or disabled for backward compatibility and usability, since YAML 1.1 specification allows this kind of implicit conversion.

@WhiredPlanck
Copy link
Copy Markdown
Author

Is there a reason why this needs to be implemented in Kaml rather than implemented as a custom serializer in your application?

@charleskorn Recently I try to implement such kind a custom serializer and found that the (de)serialization will not (de)serailize the field with my custom serializer even I've specified it to the class or the field. I have no idea if it's a bug or I've made a mistake.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants