Skip to content

Add merge support for Scala collections #481

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

Merged
merged 1 commit into from
Nov 26, 2020

Conversation

helfper
Copy link
Contributor

@helfper helfper commented Nov 26, 2020

This PR adds support for Jackson's merge feature to Scala collection deserializers. Closes #370

Not sure if this is the best way to go about it, but it's working properly in the examples I've tried. Merge support is done by implementing the method JsonDeserializer.deserialize(JsonParser p, DeserializationContext ctxt, T intoValue) which takes the previous value to be updated/merged with the new fields coming from JSON. Support for Scala's Maps is particularly tricky because GenericMapFactoryDeserializerResolver is based on MapDeserializer which tries to access Map.get(...) for deep merging, but Scala's Builder doesn't have a get, so it wasn't straightforward to add a get to BuilderWrapper.

@pjfanning pjfanning merged commit 5bc4432 into FasterXML:2.12 Nov 26, 2020
@helfper helfper deleted the merge-map-and-list branch November 27, 2020 09:56
@pjfanning
Copy link
Member

@helfper I merged this to the master branch - which is being using to develop jackson 3.

One of the MergeTest unit test fails on that branch. Could you have a look?

@helfper helfper mentioned this pull request Nov 29, 2020
@helfper
Copy link
Contributor Author

helfper commented Nov 29, 2020

@pjfanning There was an extra defaultMergeable added during merge. I've raised #484 to fix it.

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.

2 participants