You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Find union members and interface implementors from @JsonSubTypes #862
Follow-up to #200 and #854. #854 only helps when the class behind a union or interface is sealed. For plain hierarchies you still need a dictionary entry per member.
A lot of these classes already list their subtypes for Jackson:
@JsonTypeInfo(use =JsonTypeInfo.Id.NAME, property ="__typename")
@JsonSubTypes(
JsonSubTypes.Type(value =MemberA::class, name ="MemberA"),
JsonSubTypes.Type(value =MemberB::class, name ="MemberB"))
interfaceAnyMember
@briankrug's patch reads that annotation in SchemaClassScanner and matches each subtype to an object type by JsonSubTypes.Type#name.
Main issue is, the JSON type name isn't the GraphQL type name. It defaults to "", and it makes a serialization annotation part of the schema mapping. Probably safer to use @JsonSubTypes only as the list of candidates and match on the class simpleName, same as the sealed lookup. It's the only route for non-sealed classes on Java 11 though.
Activity