diff --git a/.changeset/orange-maps-raise.md b/.changeset/orange-maps-raise.md new file mode 100644 index 0000000000..02a606ceff --- /dev/null +++ b/.changeset/orange-maps-raise.md @@ -0,0 +1,5 @@ +--- +'@urql/introspection': minor +--- + +Update `minifyIntrospectionQuery` utility to remove additional information on arguments and to filter out schema metadata types, like `__Field` and others. diff --git a/packages/introspection/src/minifyIntrospectionQuery.ts b/packages/introspection/src/minifyIntrospectionQuery.ts index 877f9dc197..e915007a7b 100644 --- a/packages/introspection/src/minifyIntrospectionQuery.ts +++ b/packages/introspection/src/minifyIntrospectionQuery.ts @@ -57,9 +57,8 @@ const minifyIntrospectionType = ( args: field.args && field.args.map(arg => ({ - ...arg, + name: arg.name, type: mapType(arg.type, anyType), - defaultValue: undefined, })), } as any) ), @@ -84,9 +83,8 @@ const minifyIntrospectionType = ( args: field.args && field.args.map(arg => ({ - ...arg, + name: arg.name, type: mapType(arg.type, anyType), - defaultValue: undefined, })), } as any) ), @@ -133,12 +131,25 @@ export const minifyIntrospectionQuery = ( } = schema; const minifiedTypes = types - .filter( - type => - type.kind === 'OBJECT' || - type.kind === 'INTERFACE' || - type.kind === 'UNION' - ) + .filter(type => { + switch (type.name) { + case '__Directive': + case '__DirectiveLocation': + case '__EnumValue': + case '__InputValue': + case '__Field': + case '__Type': + case '__TypeKind': + case '__Schema': + return false; + default: + return ( + type.kind === 'OBJECT' || + type.kind === 'INTERFACE' || + type.kind === 'UNION' + ); + } + }) .map(minifyIntrospectionType); minifiedTypes.push({ kind: 'SCALAR', name: anyType.name });