FasterXML / FasterXML/jackson-databind

possibility to not require JsonTypeInfo annotation for sealed classes?

Open
#3,596 15 comments 1 reaction 0 assignees View on GitHub
3.x polymorphic-handling
Dominant language
Java
Stars
3.7k
Forks
1.5k
Avg merge
3d 6h
Merged PRs (30d)
28

Description

Scala, Kotlin and Java 17 have sealed classes. It is possible to write introspectors that find the subtypes.
It would be great if jackson-databind could infer a default JsonTypeInfo setting for sealed traits/interfaces/abstract-classes

A default like this, perhaps:
```
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
```

* https://github.com/pjfanning/jackson-scala-reflect-extensions/pull/9
* https://github.com/FasterXML/jackson-databind/pull/3549
* https://kotlinlang.org/docs/sealed-classes.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.