Skip to content

Commit

Permalink
BREAKING: Remove deprecated introspection fields (#1385)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
leebyron authored Jun 12, 2018
1 parent 4dc81fb commit 626b7a9
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 74 deletions.
45 changes: 0 additions & 45 deletions src/type/__tests__/introspection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,51 +698,6 @@ describe('Introspection', () => {
isDeprecated: false,
deprecationReason: null,
},
{
name: 'onOperation',
args: [],
type: {
kind: 'NON_NULL',
name: null,
ofType: {
kind: 'SCALAR',
name: 'Boolean',
ofType: null,
},
},
isDeprecated: true,
deprecationReason: 'Use `locations`.',
},
{
name: 'onFragment',
args: [],
type: {
kind: 'NON_NULL',
name: null,
ofType: {
kind: 'SCALAR',
name: 'Boolean',
ofType: null,
},
},
isDeprecated: true,
deprecationReason: 'Use `locations`.',
},
{
name: 'onField',
args: [],
type: {
kind: 'NON_NULL',
name: null,
ofType: {
kind: 'SCALAR',
name: 'Boolean',
ofType: null,
},
},
isDeprecated: true,
deprecationReason: 'Use `locations`.',
},
],
inputFields: null,
interfaces: [],
Expand Down
23 changes: 0 additions & 23 deletions src/type/introspection.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,29 +100,6 @@ export const __Directive = new GraphQLObjectType({
type: GraphQLNonNull(GraphQLList(GraphQLNonNull(__InputValue))),
resolve: directive => directive.args || [],
},
// NOTE: the following three fields are deprecated and are no longer part
// of the GraphQL specification.
onOperation: {
deprecationReason: 'Use `locations`.',
type: GraphQLNonNull(GraphQLBoolean),
resolve: d =>
d.locations.indexOf(DirectiveLocation.QUERY) !== -1 ||
d.locations.indexOf(DirectiveLocation.MUTATION) !== -1 ||
d.locations.indexOf(DirectiveLocation.SUBSCRIPTION) !== -1,
},
onFragment: {
deprecationReason: 'Use `locations`.',
type: GraphQLNonNull(GraphQLBoolean),
resolve: d =>
d.locations.indexOf(DirectiveLocation.FRAGMENT_SPREAD) !== -1 ||
d.locations.indexOf(DirectiveLocation.INLINE_FRAGMENT) !== -1 ||
d.locations.indexOf(DirectiveLocation.FRAGMENT_DEFINITION) !== -1,
},
onField: {
deprecationReason: 'Use `locations`.',
type: GraphQLNonNull(GraphQLBoolean),
resolve: d => d.locations.indexOf(DirectiveLocation.FIELD) !== -1,
},
}),
});

Expand Down
6 changes: 0 additions & 6 deletions src/utilities/__tests__/schemaPrinter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,6 @@ describe('Type System Printer', () => {
description: String
locations: [__DirectiveLocation!]!
args: [__InputValue!]!
onOperation: Boolean! @deprecated(reason: "Use \`locations\`.")
onFragment: Boolean! @deprecated(reason: "Use \`locations\`.")
onField: Boolean! @deprecated(reason: "Use \`locations\`.")
}
"""
Expand Down Expand Up @@ -881,9 +878,6 @@ describe('Type System Printer', () => {
description: String
locations: [__DirectiveLocation!]!
args: [__InputValue!]!
onOperation: Boolean! @deprecated(reason: "Use \`locations\`.")
onFragment: Boolean! @deprecated(reason: "Use \`locations\`.")
onField: Boolean! @deprecated(reason: "Use \`locations\`.")
}
# A Directive can be adjacent to many parts of the GraphQL language, a
Expand Down

0 comments on commit 626b7a9

Please sign in to comment.