Skip to content

Commit 626b7a9

Browse files
authored
BREAKING: Remove deprecated introspection fields (#1385)
These fields are holdovers from the first version of the spec, before directives had more control over their exact location and could be located in more places. This is potentially breaking to any clients which relied on these fields, which will need to migrate to use the spec-compliant `locations` field before upgrading to a version including this patch
1 parent 4dc81fb commit 626b7a9

File tree

3 files changed

+0
-74
lines changed

3 files changed

+0
-74
lines changed

src/type/__tests__/introspection-test.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -698,51 +698,6 @@ describe('Introspection', () => {
698698
isDeprecated: false,
699699
deprecationReason: null,
700700
},
701-
{
702-
name: 'onOperation',
703-
args: [],
704-
type: {
705-
kind: 'NON_NULL',
706-
name: null,
707-
ofType: {
708-
kind: 'SCALAR',
709-
name: 'Boolean',
710-
ofType: null,
711-
},
712-
},
713-
isDeprecated: true,
714-
deprecationReason: 'Use `locations`.',
715-
},
716-
{
717-
name: 'onFragment',
718-
args: [],
719-
type: {
720-
kind: 'NON_NULL',
721-
name: null,
722-
ofType: {
723-
kind: 'SCALAR',
724-
name: 'Boolean',
725-
ofType: null,
726-
},
727-
},
728-
isDeprecated: true,
729-
deprecationReason: 'Use `locations`.',
730-
},
731-
{
732-
name: 'onField',
733-
args: [],
734-
type: {
735-
kind: 'NON_NULL',
736-
name: null,
737-
ofType: {
738-
kind: 'SCALAR',
739-
name: 'Boolean',
740-
ofType: null,
741-
},
742-
},
743-
isDeprecated: true,
744-
deprecationReason: 'Use `locations`.',
745-
},
746701
],
747702
inputFields: null,
748703
interfaces: [],

src/type/introspection.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,6 @@ export const __Directive = new GraphQLObjectType({
100100
type: GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
101101
resolve: directive => directive.args || [],
102102
},
103-
// NOTE: the following three fields are deprecated and are no longer part
104-
// of the GraphQL specification.
105-
onOperation: {
106-
deprecationReason: 'Use `locations`.',
107-
type: GraphQLNonNull(GraphQLBoolean),
108-
resolve: d =>
109-
d.locations.indexOf(DirectiveLocation.QUERY) !== -1 ||
110-
d.locations.indexOf(DirectiveLocation.MUTATION) !== -1 ||
111-
d.locations.indexOf(DirectiveLocation.SUBSCRIPTION) !== -1,
112-
},
113-
onFragment: {
114-
deprecationReason: 'Use `locations`.',
115-
type: GraphQLNonNull(GraphQLBoolean),
116-
resolve: d =>
117-
d.locations.indexOf(DirectiveLocation.FRAGMENT_SPREAD) !== -1 ||
118-
d.locations.indexOf(DirectiveLocation.INLINE_FRAGMENT) !== -1 ||
119-
d.locations.indexOf(DirectiveLocation.FRAGMENT_DEFINITION) !== -1,
120-
},
121-
onField: {
122-
deprecationReason: 'Use `locations`.',
123-
type: GraphQLNonNull(GraphQLBoolean),
124-
resolve: d => d.locations.indexOf(DirectiveLocation.FIELD) !== -1,
125-
},
126103
}),
127104
});
128105

src/utilities/__tests__/schemaPrinter-test.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,6 @@ describe('Type System Printer', () => {
648648
description: String
649649
locations: [__DirectiveLocation!]!
650650
args: [__InputValue!]!
651-
onOperation: Boolean! @deprecated(reason: "Use \`locations\`.")
652-
onFragment: Boolean! @deprecated(reason: "Use \`locations\`.")
653-
onField: Boolean! @deprecated(reason: "Use \`locations\`.")
654651
}
655652
656653
"""
@@ -881,9 +878,6 @@ describe('Type System Printer', () => {
881878
description: String
882879
locations: [__DirectiveLocation!]!
883880
args: [__InputValue!]!
884-
onOperation: Boolean! @deprecated(reason: "Use \`locations\`.")
885-
onFragment: Boolean! @deprecated(reason: "Use \`locations\`.")
886-
onField: Boolean! @deprecated(reason: "Use \`locations\`.")
887881
}
888882
889883
# A Directive can be adjacent to many parts of the GraphQL language, a

0 commit comments

Comments
 (0)