Skip to content

Keep order of specified definitions consistent with the spec #4428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions src/type/__tests__/introspection-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -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: [],
Expand Down Expand Up @@ -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: [],
Expand Down Expand Up @@ -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: [],
Expand Down
18 changes: 9 additions & 9 deletions src/type/introspection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand All @@ -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<GraphQLDirective, unknown>,
});

Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/__tests__/printSchema-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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!
}

"""
Expand Down
Loading