mbknor / mbknor-jackson-jsonSchema

Generate JSON Schema with Polymorphism using Jackson annotations
MIT License
232 stars 75 forks source link

Add support for @JsonTypeInfo on interfaces #135

Closed big-andy-coates closed 3 years ago

big-andy-coates commented 3 years ago

fixes: https://github.com/mbknor/mbknor-jackson-jsonSchema/issues/134

Jackson supports @JsonTypeInfo on interfaces, not just classes. If use is set to anything other than Id.Type then currently the generator invokes ClassGraph to find the the subtypes of the type. However, ClassGraph has different methods for finding implementations of an interface vs subtypes of a class: getClassesImplementing vs getSubclasses respectively.

This change enhances the generator to call getClassesImplementing when the type annotated with @JsonTypeInfo is an interface.

mbknor commented 3 years ago

Thanks.. I've rebased this PR on master and merged it manuallt

big-andy-coates commented 3 years ago

Thanks.