-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
avro serialization of pojo with dynamic @JsonAnyGetter fields #75
Comments
Interesting. I assume this should work, as long as schema has such field so looks like a bug to me. |
Actually, no. I should have read it more closely: you are generating Avro schema from POJO, and it has no real properties, just any setter/getter. As a result, Avro schema does not have any properties; and with that there is no way to encode contents. This should, however, work if schema in use did have properties matching what "any getter" provides. |
the point was that the AvroSchemaGenerator fails generating the schema for @JsonAnyGetter fields. I would expect this results in a avro Map field representing the any params. I assume had there been this map in the schema generated, then it would have been possible to serialize/deserialize its values? |
@antonymayi Yes, if there was a I could see possible feature or something, to allow translating intent so perhaps it'd work like you suggest, but then there'd be question of what logical name to use for that So I am open to suggestions but just not quite sure how this could be made to work in a consistent and reliable way. |
@cowtowncoder I would argue that if people want to do that, they should just have the map property on their POJO and serialize that without I could see an argument for making
|
@baharclerode I concur -- interesting note on I may file a new issue for potential continuation, close this one, but will keep this one open for a bit longer. |
@baharclerode come to think of it, wouldn't |
@cowtowncoder It does, except the I've not looked into how the skipping functionality might affect things. |
@baharclerode Ohhh. Actually, I think this calls for one change: I think most of the time users would default to
Looks like this is handled via |
Yeah, I think that would make the most sense for behavior. |
Associated test has been passing at least since 2.13(.5), will mark as closed. Note: test creates |
Is it possible to serialize pojo with dynamic fields implemented using @JsonAnyGetter? This currently fails:
That throws following:
The text was updated successfully, but these errors were encountered: