Skip to content
Merged
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
12 changes: 11 additions & 1 deletion src/type/__tests__/introspection-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,17 @@ describe('Introspection', () => {
},
{
name: 'args',
args: [],
args: [
{
name: 'includeDeprecated',
type: {
kind: 'SCALAR',
name: 'Boolean',
ofType: null,
},
defaultValue: 'false',
},
],
type: {
kind: 'NON_NULL',
name: null,
Expand Down
12 changes: 11 additions & 1 deletion src/type/introspection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,17 @@ export const __Directive: GraphQLObjectType = new GraphQLObjectType({
type: new GraphQLNonNull(
new GraphQLList(new GraphQLNonNull(__InputValue)),
),
resolve: (directive) => directive.args,
args: {
includeDeprecated: {
type: GraphQLBoolean,
defaultValue: false,
},
},
resolve(field, { includeDeprecated }) {
return includeDeprecated
? field.args
: field.args.filter((arg) => arg.deprecationReason == null);
},
},
} as GraphQLFieldConfigMap<GraphQLDirective, unknown>),
});
Expand Down
14 changes: 14 additions & 0 deletions src/utilities/__tests__/getIntrospectionQuery-test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';

import { parse } from '../../language/parser';

import { validate } from '../../validation/validate';

import type { IntrospectionOptions } from '../getIntrospectionQuery';
import { buildSchema } from '../buildASTSchema';
import { getIntrospectionQuery } from '../getIntrospectionQuery';

const dummySchema = buildSchema(`
type Query {
dummy: String
}
`);

function expectIntrospectionQuery(options?: IntrospectionOptions) {
const query = getIntrospectionQuery(options);

const validationErrors = validate(dummySchema, parse(query));
expect(validationErrors).to.deep.equal([]);

return {
toMatch(name: string, times: number = 1): void {
const pattern = toRegExp(name);
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/__tests__/printSchema-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ describe('Type System Printer', () => {
description: String
isRepeatable: Boolean!
locations: [__DirectiveLocation!]!
args: [__InputValue!]!
args(includeDeprecated: Boolean = false): [__InputValue!]!
}

"""
Expand Down