diff --git a/src/type/__tests__/introspection-test.ts b/src/type/__tests__/introspection-test.ts index d5157b9750..6bac4402b1 100644 --- a/src/type/__tests__/introspection-test.ts +++ b/src/type/__tests__/introspection-test.ts @@ -225,17 +225,6 @@ describe('Introspection', () => { isDeprecated: false, deprecationReason: null, }, - { - name: 'specifiedByURL', - args: [], - type: { - kind: 'SCALAR', - name: 'String', - ofType: null, - }, - isDeprecated: false, - deprecationReason: null, - }, { name: 'fields', args: [ @@ -384,6 +373,17 @@ describe('Introspection', () => { isDeprecated: false, deprecationReason: null, }, + { + name: 'specifiedByURL', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, { name: 'isOneOf', args: [], @@ -750,21 +750,6 @@ describe('Introspection', () => { isDeprecated: false, deprecationReason: null, }, - { - name: 'isRepeatable', - args: [], - type: { - kind: 'NON_NULL', - name: null, - ofType: { - kind: 'SCALAR', - name: 'Boolean', - ofType: null, - }, - }, - isDeprecated: false, - deprecationReason: null, - }, { name: 'locations', args: [], @@ -825,6 +810,21 @@ describe('Introspection', () => { isDeprecated: false, deprecationReason: null, }, + { + name: 'isRepeatable', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, ], inputFields: null, interfaces: [], diff --git a/src/type/introspection.ts b/src/type/introspection.ts index e9181f53ca..ead0fc284e 100644 --- a/src/type/introspection.ts +++ b/src/type/introspection.ts @@ -91,10 +91,6 @@ export const __Directive: GraphQLObjectType = new GraphQLObjectType({ type: GraphQLString, resolve: (directive) => directive.description, }, - isRepeatable: { - type: new GraphQLNonNull(GraphQLBoolean), - resolve: (directive) => directive.isRepeatable, - }, locations: { type: new GraphQLNonNull( new GraphQLList(new GraphQLNonNull(__DirectiveLocation)), @@ -117,6 +113,10 @@ export const __Directive: GraphQLObjectType = new GraphQLObjectType({ : field.args.filter((arg) => arg.deprecationReason == null); }, }, + isRepeatable: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (directive) => directive.isRepeatable, + }, }) as GraphQLFieldConfigMap, }); @@ -257,11 +257,6 @@ export const __Type: GraphQLObjectType = new GraphQLObjectType({ /* c8 ignore next */ 'description' in type ? type.description : undefined, }, - specifiedByURL: { - type: GraphQLString, - resolve: (obj) => - 'specifiedByURL' in obj ? obj.specifiedByURL : undefined, - }, fields: { type: new GraphQLList(new GraphQLNonNull(__Field)), args: { @@ -333,6 +328,11 @@ export const __Type: GraphQLObjectType = new GraphQLObjectType({ type: __Type, resolve: (type) => ('ofType' in type ? type.ofType : undefined), }, + specifiedByURL: { + type: GraphQLString, + resolve: (obj) => + 'specifiedByURL' in obj ? obj.specifiedByURL : undefined, + }, isOneOf: { type: GraphQLBoolean, resolve: (type) => { diff --git a/src/utilities/__tests__/printSchema-test.ts b/src/utilities/__tests__/printSchema-test.ts index b03e01026e..ea2ba65f3a 100644 --- a/src/utilities/__tests__/printSchema-test.ts +++ b/src/utilities/__tests__/printSchema-test.ts @@ -854,13 +854,13 @@ describe('Type System Printer', () => { kind: __TypeKind! name: String description: String - specifiedByURL: String fields(includeDeprecated: Boolean! = false): [__Field!] interfaces: [__Type!] possibleTypes: [__Type!] enumValues(includeDeprecated: Boolean! = false): [__EnumValue!] inputFields(includeDeprecated: Boolean! = false): [__InputValue!] ofType: __Type + specifiedByURL: String isOneOf: Boolean } @@ -943,9 +943,9 @@ describe('Type System Printer', () => { type __Directive { name: String! description: String - isRepeatable: Boolean! locations: [__DirectiveLocation!]! args(includeDeprecated: Boolean! = false): [__InputValue!]! + isRepeatable: Boolean! } """