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

Ability to determine schema of Immutable objects persisted to MongoDB #1130

Open
DipaanB opened this issue Dec 5, 2019 · 1 comment
Open

Comments

@DipaanB
Copy link

DipaanB commented Dec 5, 2019

We need the ability to determine the schema of Immutable objects that are persisted in a database like MongoDB. Since there is no way to inspect private fields of the Immutable class using reflection, the closest available alternative was to inspect the mutator methods on the Immutable Builder class. But that approach is hacky, because the builder class has additional methods (equals, from, wait and collection utility methods like addAll, remove, set, etc.). Additionally, the builder sometimes has overloaded methods, e.g. if a field is of type Optional. Also, fields annotated with @Gson.Ignore can't be excluded from the schema, when enumerating mutators on the Builder. So far, generating a new _Fields class seems to be the best available option to be able to determine a database schema. See #1129.

@asereda-gs
Copy link
Member

Hi @DipaanB there is already a discussion about exposing metadata on Immutables objects (see #1006).

Meanwhile, if you're using Jackson serialization, would Jackson JsonSchema module help ?

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