-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
(note: regression partly due to #3373, reported f.ex as #4354 (but not just that))
So: if custom TypeIdResolver
returns null
from idFromValue()
or idFromValueAndType()
, result is that underlying JsonGenerator.writeTypePrefix()
call is omitted. This may work for some cases, but won't for others, because necessary parts of structure are missing.
Conceptually the idea would be that null
for Type Id means "do not add Type Id", but doing so cannot be done by simply skipping calls to JsonGenerator
s writeTypePrefix()
and writeTypeSuffix()
: rather, calls need to be made but these methods need to be aware of possibly missing type id and output whatever else is necessary.
EDIT: another way to describe this is that if idFromValue()
/ idFromValueAndType()
returns null
, serialization occurs AS IF non-polymorphic serialization was used. For As.PROPERTY
/ As.EXISTING_PROPERTY
, for example, output would be similar but without "type": "typeId"
entry in JSON Object; and for wrappers (As.ARRAY_WRAPPER
/ As.OBJECT_WRAPPER
) no wrapping is added.