@@ -16,6 +16,7 @@ import {
1616 parse ,
1717 visit ,
1818 type DocumentNode ,
19+ type IntrospectionOptions ,
1920 type IntrospectionQuery ,
2021} from 'graphql' ;
2122import { stringInterpolator } from '@graphql-mesh/string-interpolation' ;
@@ -97,6 +98,25 @@ export interface GraphQLSubgraphLoaderHTTPConfiguration {
9798 * @default 'http'
9899 */
99100 transportKind ?: 'http' ;
101+
102+ /**
103+ * While introspecting the schema, you can customize the introspection query by providing these options.
104+ * This is useful if you have a GraphQL server that does not support some of the newer features of GraphQL.
105+ *
106+ * By default, Mesh has the following options;
107+ *
108+ * ```json
109+ * {
110+ * "descriptions": true,
111+ * "specifiedByUrl": false,
112+ * "directiveIsRepeatable": false,
113+ * "schemaDescription": false,
114+ * "inputValueDeprecation": true,
115+ * "oneOf": false
116+ * }
117+ * ```
118+ */
119+ introspectionOptions ?: IntrospectionOptions ;
100120}
101121
102122function fixExtends ( node : DocumentNode ) {
@@ -218,6 +238,15 @@ function fixExtends(node: DocumentNode) {
218238 } ) ;
219239}
220240
241+ export const DEFAULT_INTROSPECTION_OPTIONS : Required < IntrospectionOptions > = {
242+ descriptions : true ,
243+ specifiedByUrl : false ,
244+ directiveIsRepeatable : false ,
245+ schemaDescription : false ,
246+ inputValueDeprecation : true ,
247+ oneOf : false ,
248+ } ;
249+
221250export function loadGraphQLHTTPSubgraph (
222251 subgraphName : string ,
223252 {
@@ -233,6 +262,8 @@ export function loadGraphQLHTTPSubgraph(
233262 source,
234263 schemaHeaders,
235264
265+ introspectionOptions = DEFAULT_INTROSPECTION_OPTIONS ,
266+
236267 federation = false ,
237268
238269 transportKind = 'http' ,
@@ -303,7 +334,7 @@ export function loadGraphQLHTTPSubgraph(
303334 ...schemaHeaders ,
304335 } ,
305336 body : JSON . stringify ( {
306- query : getIntrospectionQuery ( ) ,
337+ query : getIntrospectionQuery ( introspectionOptions ) ,
307338 } ) ,
308339 } ) ,
309340 res => {
0 commit comments