Skip to content
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

Fix #2895 inputValueDeprecation: true getIntrospectionQuery error #3046

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 24 additions & 1 deletion 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';
Expand Down Expand Up @@ -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);
});
});
2 changes: 1 addition & 1 deletion src/utilities/__tests__/getIntrospectionQuery-test.js
Expand Up @@ -108,7 +108,7 @@ describe('getIntrospectionQuery', () => {

expectIntrospectionQuery({ inputValueDeprecation: true }).toMatch(
'includeDeprecated: true',
5,
4,
);

expectIntrospectionQuery({ inputValueDeprecation: false }).toMatch(
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/getIntrospectionQuery.js
Expand Up @@ -62,7 +62,7 @@ export function getIntrospectionQuery(options?: IntrospectionOptions): string {
${descriptions}
${directiveIsRepeatable}
locations
args${inputDeprecation('(includeDeprecated: true)')} {
args {
...InputValue
}
}
Expand Down