|
48 | 48 | import org.springframework.util.MultiValueMap;
|
49 | 49 |
|
50 | 50 | /**
|
51 |
| - * Provide {@link #inspect(GraphQLSchema, RuntimeWiring)} method that checks if |
52 |
| - * schema fields are covered by either a {@link DataFetcher} registration, or a |
53 |
| - * Java object property. Fields that have neither are reported as unmapped in |
54 |
| - * the output {@link Report}. |
| 51 | + * Declares an {@link #inspect(GraphQLSchema, RuntimeWiring)} method that checks |
| 52 | + * if schema fields are covered either by a {@link DataFetcher} registration, |
| 53 | + * or match a Java object property. Fields that have neither are reported as |
| 54 | + * "unmapped" in the resulting {@link Report Resport}. |
55 | 55 | *
|
56 |
| - * <p>The inspection depends on {@code DataFetcher}s to expose return type |
57 |
| - * information by implementing {@link SelfDescribingDataFetcher}. This allows |
58 |
| - * checking if Java object types have properties that match schema fields. |
59 |
| - * If a {@code DataFetcher} does not implement this interface, then the Java |
60 |
| - * object type is not known, and the field type is reported as skipped. |
| 56 | + * <p>The inspection depends on {@code DataFetcher}s to be |
| 57 | + * {@link SelfDescribingDataFetcher} to be able to compare schema type and Java |
| 58 | + * object type structure. If a {@code DataFetcher} does not implement this |
| 59 | + * interface, then the Java type remains unknown, and the field type is reported |
| 60 | + * as "skipped". |
61 | 61 | *
|
62 |
| - * <p>The {@link SelfDescribingDataFetcher} for annotated controller methods |
63 |
| - * exposes the declared return type of the controller method. If the return type |
64 |
| - * is {@link Object} such as for a union, then the Java object structure is |
65 |
| - * not known, and the field output type is reported as skipped. |
| 62 | + * <p>The {@code SelfDescribingDataFetcher} for an annotated controller method |
| 63 | + * derives type information from the controller method signature. If the declared |
| 64 | + * return type is {@link Object}, or an unspecified generic parameter such as |
| 65 | + * {@code List<?>} then the Java type structure remains unknown, and the field |
| 66 | + * output type is reported as skipped. |
66 | 67 | *
|
67 |
| - * <p>Union types are automatically skipped because there is no way for an |
68 |
| - * annotated controller method to declare the actual Java types. |
| 68 | + * <p>Unions are always skipped because there is no way for an annotated |
| 69 | + * controller method to express that in a return type, and the Java type |
| 70 | + * structure remains unknown. |
| 71 | + * |
| 72 | + * <p>Interfaces are supported only as far as fields declared directly on the |
| 73 | + * interface, which are compared against properties of the Java type declared |
| 74 | + * by a {@code SelfDescribingDataFetcher}. |
69 | 75 | *
|
70 | 76 | * @author Brian Clozel
|
71 | 77 | * @author Rossen Stoyanchev
|
@@ -242,9 +248,9 @@ public static Report inspect(GraphQLSchema schema, RuntimeWiring runtimeWiring)
|
242 | 248 |
|
243 | 249 |
|
244 | 250 | /**
|
245 |
| - * Container of unmapped fields and skipped types. |
246 |
| - * @param unmappedFields fields with neither {@link DataFetcher} mapping nor Object property |
247 |
| - * @param skippedTypes types that could not be verified, e.g. union |
| 251 | + * The report produced as a result of schema mappings inspection. |
| 252 | + * @param unmappedFields a map with type names as keys, and unmapped field names as values |
| 253 | + * @param skippedTypes the names of types skipped by the inspection |
248 | 254 | */
|
249 | 255 | public record Report(MultiValueMap<String, String> unmappedFields, Set<String> skippedTypes) {
|
250 | 256 |
|
|
0 commit comments