diff --git a/src/type/__tests__/introspection-test.js b/src/type/__tests__/introspection-test.js index 478cc9bd18..ca4e93936c 100644 --- a/src/type/__tests__/introspection-test.js +++ b/src/type/__tests__/introspection-test.js @@ -1,4 +1,4 @@ -import { expect } from 'chai'; +import { assert, expect } from 'chai'; import { describe, it } from 'mocha'; import invariant from '../../jsutils/invariant'; @@ -1586,4 +1586,27 @@ describe('Introspection', () => { }), ).to.not.throw(); }); + + it('can include deprecated input fields', () => { + const schema = buildSchema(` + type Query { + oldField(input: Boolean @deprecated(reason: "got over it")): String + } + `); + + const source = getIntrospectionQuery({ + inputValueDeprecation: true, + }); + + const { data, errors } = graphqlSync({ + schema, + source, + }); + + assert.isUndefined( + errors, + `Introspection query was not successful ${JSON.stringify(errors) || ''}`, + ); + assert.isOk(data); + }); }); diff --git a/src/utilities/__tests__/getIntrospectionQuery-test.js b/src/utilities/__tests__/getIntrospectionQuery-test.js index 3f0c36298f..c64db38adf 100644 --- a/src/utilities/__tests__/getIntrospectionQuery-test.js +++ b/src/utilities/__tests__/getIntrospectionQuery-test.js @@ -108,7 +108,7 @@ describe('getIntrospectionQuery', () => { expectIntrospectionQuery({ inputValueDeprecation: true }).toMatch( 'includeDeprecated: true', - 5, + 4, ); expectIntrospectionQuery({ inputValueDeprecation: false }).toMatch( diff --git a/src/utilities/getIntrospectionQuery.js b/src/utilities/getIntrospectionQuery.js index 1c9abb4204..35ee0459c6 100644 --- a/src/utilities/getIntrospectionQuery.js +++ b/src/utilities/getIntrospectionQuery.js @@ -62,7 +62,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string { ${descriptions} ${directiveIsRepeatable} locations - args${inputDeprecation('(includeDeprecated: true)')} { + args { ...InputValue } }