@@ -112,14 +112,14 @@ private SchemaMappingInspector(GraphQLSchema schema, RuntimeWiring runtimeWiring
112
112
*/
113
113
public Report inspect () {
114
114
115
- inspectSchemaType (this .schema .getQueryType (), null );
115
+ inspectSchemaType (this .schema .getQueryType (), null , false );
116
116
117
117
if (this .schema .isSupportingMutations ()) {
118
- inspectSchemaType (this .schema .getMutationType (), null );
118
+ inspectSchemaType (this .schema .getMutationType (), null , false );
119
119
}
120
120
121
121
if (this .schema .isSupportingSubscriptions ()) {
122
- inspectSchemaType (this .schema .getSubscriptionType (), null );
122
+ inspectSchemaType (this .schema .getSubscriptionType (), null , false );
123
123
}
124
124
125
125
inspectDataFetcherRegistrations ();
@@ -128,7 +128,7 @@ public Report inspect() {
128
128
}
129
129
130
130
@ SuppressWarnings ("rawtypes" )
131
- private void inspectSchemaType (GraphQLType type , @ Nullable ResolvableType resolvableType ) {
131
+ private void inspectSchemaType (GraphQLType type , @ Nullable ResolvableType resolvableType , boolean subscription ) {
132
132
Assert .notNull (type , "No GraphQLType" );
133
133
134
134
type = unwrapNonNull (type );
@@ -138,7 +138,7 @@ private void inspectSchemaType(GraphQLType type, @Nullable ResolvableType resolv
138
138
}
139
139
else if (type instanceof GraphQLList listType ) {
140
140
type = unwrapNonNull (listType .getWrappedType ());
141
- resolvableType = nestForList (resolvableType , type );
141
+ resolvableType = nestForList (resolvableType , type , subscription );
142
142
}
143
143
else {
144
144
resolvableType = (resolvableType != null ? nestIfReactive (resolvableType ) : null );
@@ -177,7 +177,9 @@ else if (resolvableType != null && resolvableType.resolve(Object.class) == Objec
177
177
if (dataFetcherMap .containsKey (fieldName )) {
178
178
DataFetcher <?> fetcher = dataFetcherMap .get (fieldName );
179
179
if (fetcher instanceof SelfDescribingDataFetcher <?> selfDescribingDataFetcher ) {
180
- inspectSchemaType (field .getType (), selfDescribingDataFetcher .getReturnType ());
180
+ inspectSchemaType (
181
+ field .getType (), selfDescribingDataFetcher .getReturnType (),
182
+ (type == this .schema .getSubscriptionType ()));
181
183
}
182
184
else if (isNotScalarOrEnumType (field .getType ())) {
183
185
if (logger .isDebugEnabled ()) {
@@ -228,15 +230,15 @@ private ResolvableType nestIfReactive(ResolvableType type) {
228
230
return type ;
229
231
}
230
232
231
- private ResolvableType nestForList (@ Nullable ResolvableType type , GraphQLType graphQlType ) {
233
+ private ResolvableType nestForList (@ Nullable ResolvableType type , GraphQLType graphQlType , boolean subscription ) {
232
234
Assert .state (type != null , "No Java type for " + getTypeName (graphQlType ));
233
235
ReactiveAdapter adapter = this .reactiveAdapterRegistry .getAdapter (type .resolve (Object .class ));
234
236
if (adapter != null ) {
235
- if (adapter .isMultiValue ()) {
236
- return type .getNested (2 );
237
- }
238
237
Assert .state (!adapter .isNoValue (), "Expected List compatible type: " + type );
239
238
type = type .getNested (2 );
239
+ if (adapter .isMultiValue () && !subscription ) {
240
+ return type ;
241
+ }
240
242
}
241
243
Assert .state (type .isArray () || type .hasGenerics (), "Expected List compatible type: " + type );
242
244
return type .getNested (2 );
0 commit comments