Currently schema inspection relies on a one-for-one match between a schema field type and a controller method return type, and that doesn't extend well to interfaces and unions as the Java types used at runtime are unknown.
We can provide support for inspection of unions and interfaces with a little bit of help from application to resolve Java types. We can navigate schema interface type hierarchies and union member types, and resolve corresponding Java types with the help of a resolver that does the reverse of what TypeResolver does. A default implementation for such a resolver can look for matching Java types under a given root package. We can also use any Java to schema type registrations that are provided in ClassNameTypeResolver.
Currently schema inspection relies on a one-for-one match between a schema field type and a controller method return type, and that doesn't extend well to interfaces and unions as the Java types used at runtime are unknown.
We can provide support for inspection of unions and interfaces with a little bit of help from application to resolve Java types. We can navigate schema interface type hierarchies and union member types, and resolve corresponding Java types with the help of a resolver that does the reverse of what
TypeResolverdoes. A default implementation for such a resolver can look for matching Java types under a given root package. We can also use any Java to schema type registrations that are provided inClassNameTypeResolver.