jackson-databind
                                
                                
                                
                                    jackson-databind copied to clipboard
                            
                            
                            
                        Auto-detect Java 17 sealed classes without manually specifying them in @JsonSubTypes
Since sealed classes were included in the java 17 release as a stable feature, I think jackson should support them and automatically detect possible subtypes without the @JsonSubTypes annotation.
Usage example
    @JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION)
    sealed interface UserEvent permits UserCreatedEvent, UserBlockedEvent {
        int getUserId();
    }
    @Value
    final class UserCreatedEvent implements UserEvent {
        LocalDateTime createdAt;
        int userId;
        //...
    }
    @Value
    final class UserBlockedEvent implements UserEvent {
        LocalDateTime blockedFrom;
        LocalDateTime blockedTo;
        int userId;
        //...
    }
Additional context Similar issue for kotlin sealed classes: https://github.com/FasterXML/jackson-module-kotlin/issues/239