jackson-databind
                                
                                 jackson-databind copied to clipboard
                                
                                    jackson-databind copied to clipboard
                            
                            
                            
                        Allow skipping writing of type id if type to serialize is `defaultImpl`
Currently it is possible to specify "defaultImpl" for @JsonTypeInfo, indicating type to use in case Type Id is not available (or is invalid or unmappable). But this default type is not taken into account for serialization.
It would make sense to allow omitting type id writing altogether, if actual type is the same as default type.
Due to backwards compatibility, however, it would make sense to not do this by default.
There are couple of standard ways to expose this functionality; and although more commonly we could specify SerializationFeature, it seems perhaps better here to configure it via new property of @JsonTypeInfo instead.
Looking at code, this may be tricky: problem is that while it seems easy to prevent writing of type id during "write type prefix" case, there is no coupling to "write type suffix" case. So it is not necessarily possible to suppress wrapping with object or array.
However, this may still work ok if we just use missing type id (null or "") for cases where we can not omit structural thing (wrapper). And while null may seem preferably in some ways, it is probably safer to just use empty String as it is a valid JSON property key unlike null.