From 935261b3ae7ec5d37de8ba2dd14a75d776f5dc45 Mon Sep 17 00:00:00 2001 From: Martin Bonnin Date: Fri, 22 Nov 2024 18:53:54 +0100 Subject: [PATCH] Make deprecation.reason non-nullable See https://github.com/graphql/graphql-spec/pull/1040 --- src/type/__tests__/introspection-test.ts | 10 +++++++--- src/type/directives.ts | 2 +- src/utilities/__tests__/printSchema-test.ts | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/type/__tests__/introspection-test.ts b/src/type/__tests__/introspection-test.ts index 29994c76ed..10cbf518cf 100644 --- a/src/type/__tests__/introspection-test.ts +++ b/src/type/__tests__/introspection-test.ts @@ -973,9 +973,13 @@ describe('Introspection', () => { defaultValue: '"No longer supported"', name: 'reason', type: { - kind: 'SCALAR', - name: 'String', - ofType: null, + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, }, }, ], diff --git a/src/type/directives.ts b/src/type/directives.ts index 6881f20532..7f5a96abe5 100644 --- a/src/type/directives.ts +++ b/src/type/directives.ts @@ -185,7 +185,7 @@ export const GraphQLDeprecatedDirective: GraphQLDirective = ], args: { reason: { - type: GraphQLString, + type: new GraphQLNonNull(GraphQLString), description: 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', defaultValue: DEFAULT_DEPRECATION_REASON, diff --git a/src/utilities/__tests__/printSchema-test.ts b/src/utilities/__tests__/printSchema-test.ts index 37af4a60f7..690e92e656 100644 --- a/src/utilities/__tests__/printSchema-test.ts +++ b/src/utilities/__tests__/printSchema-test.ts @@ -680,7 +680,7 @@ describe('Type System Printer', () => { """ Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/). """ - reason: String = "No longer supported" + reason: String! = "No longer supported" ) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE """Exposes a URL that specifies the behavior of this scalar."""