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

Issue #500: Serialization of a Map fails if the key uses a custom Serializer #501

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

rmartinc
Copy link
Contributor

@rmartinc rmartinc commented Jul 8, 2021

Issue: #500

As commented in the issue the PR just adds two methods to MapSerializer (serializeKey and serializeValue) that should be called previously to serialize the map keys or values. The method is just used to change the index of the type (key=0 or value=1).

Added a new test inside the MapToEntriesArraySerializerTest.java. All the needed classes have been added as inner ones inside the same class. If you prefer to move them to the model package just let me know.

Any improvement will be welcomed. 😃

The idea is preparing another PR for 1.x branch when this one is ready.

Thanks in advance!

@Verdent Verdent self-requested a review July 19, 2021 08:41
@rmartinc
Copy link
Contributor Author

Hi! Any news about this? Do you see it OK?

@Verdent
Copy link
Member

Verdent commented Aug 30, 2021

Hi @rmartinc ,
Thank you for pinging me. I had some urgent issues to fix in other project, but I would like dedicate several days this week to take care of Yasson stuff :-)

@rmartinc
Copy link
Contributor Author

@Verdent If you have time to check this one too, it would be much appreciated! 😉

@rmartinc
Copy link
Contributor Author

rmartinc commented Nov 4, 2021

Something new about this PR? We are also interested in this one... Thanks in advance!

@Verdent
Copy link
Member

Verdent commented Nov 4, 2021

@rmartinc Currently reviewing it :-) Btw could you please send me an email? I would like to discuss with you some unrelated stuff. I have mine mentioned in the profile.

Comment on lines 909 to 936
String json = jsonb.toJson(mapObject);
MapObjectLocaleString resObject = jsonb.fromJson(json, MapObjectLocaleString.class);
assertEquals(mapObject, resObject);
Copy link
Member

Choose a reason for hiding this comment

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

I might ask you to make "expected" String, which will contain the expected format produced json. The reason for that is, when you serialize object it can produce json which is deserializable back just fine, but it might not be the expected format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! I have also read the json string as a JsonObject and checked all the "values" array is as expected. Regards!

@Verdent Verdent merged commit dd42d0a into eclipse-ee4j:master Nov 16, 2021
rmartinc added a commit to rmartinc/yasson that referenced this pull request Nov 25, 2021
Verdent pushed a commit that referenced this pull request Nov 25, 2021
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