Replies: 2 comments 1 reply
-
SerializerProvider has this method Activating DefaultTyping affects the SubtypeResolver but I haven't checked what gets returned by |
Beta Was this translation helpful? Give feedback.
-
Quick note: serializers should not handle type id addition; separate However, custom Wrt mention of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
If a Serializer is producing output and Default typing is turned on, that serializer should be accounting for the default typing and ensuring it adds an appropriate attribute. However
com.fasterxml.jackson.databind.JsonSerializer#serialize
only gets a JsonGenerator and SerializerProvider in it's arguments and if there is a route to the mapper's configuration through those objects I wasn't able to find it.Many other things that might be turned on or off could be discovered via
isEnabled()
but default typing isn't a feature so it's not exposed there. Furthermore details like the property being used (usually@class
but IIUC it can vary), and the DefaultTyping mode (i.e. NON_FINAL, etc) would be important.com.fasterxml.jackson.databind.JsonSerializer#serializeWithType looks promising but at least when serializing an ID for an
ObjectIdGenerator
, this is never called. (although the deserialization process does call the deserializeWithType method)Beta Was this translation helpful? Give feedback.
All reactions