Skip to content

Add support for asymetric property name serialization / deserialization#105

Merged
suruuK merged 7 commits intomasterfrom
asymetric_serialization
Jun 12, 2024
Merged

Add support for asymetric property name serialization / deserialization#105
suruuK merged 7 commits intomasterfrom
asymetric_serialization

Conversation

@suruuK
Copy link
Contributor

@suruuK suruuK commented Jun 10, 2024

Similar to @RosettaProperty but this adds @RosettaGetter and @RosettaSetter annotations to idependently control how serialization and deserialization naming is evaluated.

When both @RosettaProperty and @RosettaGetter/@RosettaSetter is set priority is giving to @RosettaGetter during serialization /@RosettaSetter during deserialization.

cc @stevie400 @Xcelled @jhaber @jaredstehler

@stevie400
Copy link
Contributor

It might make sense to add fields like deserializationName to the RosettaProperty annotation instead of adding new annotations. If we do want new annotations, would @RosettaSerializationProperty and @RosettaDeserializationProperty be more clear names?

@suruuK
Copy link
Contributor Author

suruuK commented Jun 11, 2024

I slightly favor the seperate annotations to line up with Jackson annotations, but i like the suggestion to rename them. It always takes me a minute to translate the @JsonGetter/@JsonSetter annotations into their usage context either serialization or deserialization.

@stevie400
Copy link
Contributor

I didn't realize Jackson already had those annotations 🤦 I think that my confusion comes from the fact that we largely put these on immutables, and so @RosettaSetter on a get method is a bit confusing. This PR is probably fine as is.

@suruuK
Copy link
Contributor Author

suruuK commented Jun 11, 2024

I think its still worth renaming the annotations RosettaSerializationProperty & RosettaDeserializationProperty and have the @JsonGetter/@JsonSetter referenced in the java docs for each of them.

@suruuK suruuK merged commit d904847 into master Jun 12, 2024
@suruuK suruuK deleted the asymetric_serialization branch June 12, 2024 14:06
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