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

fix: Hocon polymorphic serialization #2151

Merged
merged 5 commits into from Dec 5, 2023
Merged

fix: Hocon polymorphic serialization #2151

merged 5 commits into from Dec 5, 2023

Conversation

LichtHund
Copy link
Contributor

@LichtHund LichtHund commented Jan 10, 2023

Hello!

I know this PR is not exactly what you guys would do to fix the issue with polymorph on HOCON, but I made a quick patch to make it work for us.

The problem is that currently Polymorph kinds are treated as Lists and tries to cast it which won't work since Config will keep it as an object.
Another issue is that the getTag will add a value.tag as the parent when trying to get the correct tag from the config (hence why the ugly and not great boolean "isPolymorph").

That said I would love this issue fixed, so please give me suggestions on how to properly fix it and I'd be more than happy to modify the PR to be up to standards!

This fix refers to #1581.

@LichtHund LichtHund marked this pull request as draft January 10, 2023 14:48
@LichtHund LichtHund marked this pull request as ready for review November 18, 2023 13:04
@LichtHund
Copy link
Contributor Author

LichtHund commented Nov 18, 2023

I ended up forgetting about this PR. 😅
Added a test with a collection and multiple entries of the same sealed type. The test fails on the current version but passes on this fix.
If there is any improvements though let me know and I'll change it asap!
We have been using this fix for well over a year now and has been working pretty well!

Copy link
Member

@sandwwraith sandwwraith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the fix! I do not have objections besides minor comments that should be easy to fix.

Copy link
Member

@sandwwraith sandwwraith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sandwwraith sandwwraith merged commit d8b98b5 into Kotlin:dev Dec 5, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants