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

Add support for preservation of unknown properties #123

Open
aseovic opened this issue May 10, 2018 · 1 comment
Open

Add support for preservation of unknown properties #123

aseovic opened this issue May 10, 2018 · 1 comment

Comments

@aseovic
Copy link
Contributor

aseovic commented May 10, 2018

At the moment, Genson either silently skips over JSON properties that do not have a corresponding JavaBean property (default), or throws an exception if failOnMissingProperty is set to true.

In some cases it is important and necessary to support preservation of unknown properties. For example, this allows clients and the server to have different versions of the JavaBean classes (typically, the server has the latest version with a full property set, and clients can either have the latest or one of the older versions) without losing properties that are not known to all clients and the servers as JSON documents move through the system.

Jackson supports this via @JsonAnySetter and @JsonAnyGetter annotations, but I believe a better approach would be to support unknown property handling in a generic way, and the users can decide what the UknownPropertyHandler should do during serialization and deserialization.

I have already implemented a proposal and will submit a pull request shortly, but just wanted to open this issue to provide some context for the PR.

@EugenCepoi
Copy link
Contributor

Perfect. This makes sense. Will take a look at the PR.

aseovic added a commit to aseovic/genson that referenced this issue May 20, 2018
aseovic added a commit to aseovic/genson that referenced this issue May 21, 2018
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

No branches or pull requests

2 participants