Skip to content

Commit a03e7c4

Browse files
Gregory-Gerardspawnia
authored andcommitted
Make includeDeprecated non-null
See graphql/graphql-spec#1142 and graphql/graphql-js#4354
1 parent 3231084 commit a03e7c4

File tree

3 files changed

+45
-25
lines changed

3 files changed

+45
-25
lines changed

src/Type/Introspection.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public static function _type(): ObjectType
354354
'type' => Type::listOf(Type::nonNull(self::_field())),
355355
'args' => [
356356
'includeDeprecated' => [
357-
'type' => Type::boolean(),
357+
'type' => Type::nonNull(Type::boolean()),
358358
'defaultValue' => false,
359359
],
360360
],
@@ -391,7 +391,7 @@ public static function _type(): ObjectType
391391
'type' => Type::listOf(Type::nonNull(self::_enumValue())),
392392
'args' => [
393393
'includeDeprecated' => [
394-
'type' => Type::boolean(),
394+
'type' => Type::nonNull(Type::boolean()),
395395
'defaultValue' => false,
396396
],
397397
],
@@ -416,7 +416,7 @@ public static function _type(): ObjectType
416416
'type' => Type::listOf(Type::nonNull(self::_inputValue())),
417417
'args' => [
418418
'includeDeprecated' => [
419-
'type' => Type::boolean(),
419+
'type' => Type::nonNull(Type::boolean()),
420420
'defaultValue' => false,
421421
],
422422
],
@@ -516,7 +516,7 @@ public static function _field(): ObjectType
516516
'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
517517
'args' => [
518518
'includeDeprecated' => [
519-
'type' => Type::boolean(),
519+
'type' => Type::nonNull(Type::boolean()),
520520
'defaultValue' => false,
521521
],
522522
],
@@ -669,7 +669,7 @@ public static function _directive(): ObjectType
669669
'type' => Type::nonNull(Type::listOf(Type::nonNull(self::_inputValue()))),
670670
'args' => [
671671
'includeDeprecated' => [
672-
'type' => Type::boolean(),
672+
'type' => Type::nonNull(Type::boolean()),
673673
'defaultValue' => false,
674674
],
675675
],

tests/Type/IntrospectionTest.php

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,13 @@ public function testExecutesAnIntrospectionQuery(): void
237237
0 => [
238238
'name' => 'includeDeprecated',
239239
'type' => [
240-
'kind' => 'SCALAR',
241-
'name' => 'Boolean',
242-
'ofType' => null,
240+
'kind' => 'NON_NULL',
241+
'name' => null,
242+
'ofType' => [
243+
'kind' => 'SCALAR',
244+
'name' => 'Boolean',
245+
'ofType' => null,
246+
],
243247
],
244248
'defaultValue' => 'false',
245249
'isDeprecated' => false,
@@ -306,9 +310,13 @@ public function testExecutesAnIntrospectionQuery(): void
306310
0 => [
307311
'name' => 'includeDeprecated',
308312
'type' => [
309-
'kind' => 'SCALAR',
310-
'name' => 'Boolean',
311-
'ofType' => null,
313+
'kind' => 'NON_NULL',
314+
'name' => null,
315+
'ofType' => [
316+
'kind' => 'SCALAR',
317+
'name' => 'Boolean',
318+
'ofType' => null,
319+
],
312320
],
313321
'defaultValue' => 'false',
314322
'isDeprecated' => false,
@@ -337,9 +345,13 @@ public function testExecutesAnIntrospectionQuery(): void
337345
0 => [
338346
'name' => 'includeDeprecated',
339347
'type' => [
340-
'kind' => 'SCALAR',
341-
'name' => 'Boolean',
342-
'ofType' => null,
348+
'kind' => 'NON_NULL',
349+
'name' => null,
350+
'ofType' => [
351+
'kind' => 'SCALAR',
352+
'name' => 'Boolean',
353+
'ofType' => null,
354+
],
343355
],
344356
'defaultValue' => 'false',
345357
'isDeprecated' => false,
@@ -478,9 +490,13 @@ public function testExecutesAnIntrospectionQuery(): void
478490
0 => [
479491
'name' => 'includeDeprecated',
480492
'type' => [
481-
'kind' => 'SCALAR',
482-
'name' => 'Boolean',
483-
'ofType' => null,
493+
'kind' => 'NON_NULL',
494+
'name' => null,
495+
'ofType' => [
496+
'kind' => 'SCALAR',
497+
'name' => 'Boolean',
498+
'ofType' => null,
499+
],
484500
],
485501
'defaultValue' => 'false',
486502
'isDeprecated' => false,
@@ -781,9 +797,13 @@ public function testExecutesAnIntrospectionQuery(): void
781797
0 => [
782798
'name' => 'includeDeprecated',
783799
'type' => [
784-
'kind' => 'SCALAR',
785-
'name' => 'Boolean',
786-
'ofType' => null,
800+
'kind' => 'NON_NULL',
801+
'name' => null,
802+
'ofType' => [
803+
'kind' => 'SCALAR',
804+
'name' => 'Boolean',
805+
'ofType' => null,
806+
],
787807
],
788808
'defaultValue' => 'false',
789809
'isDeprecated' => false,

tests/Utils/SchemaPrinterTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,11 +1083,11 @@ public function testPrintIntrospectionSchema(): void
10831083
kind: __TypeKind!
10841084
name: String
10851085
description: String
1086-
fields(includeDeprecated: Boolean = false): [__Field!]
1086+
fields(includeDeprecated: Boolean! = false): [__Field!]
10871087
interfaces: [__Type!]
10881088
possibleTypes: [__Type!]
1089-
enumValues(includeDeprecated: Boolean = false): [__EnumValue!]
1090-
inputFields(includeDeprecated: Boolean = false): [__InputValue!]
1089+
enumValues(includeDeprecated: Boolean! = false): [__EnumValue!]
1090+
inputFields(includeDeprecated: Boolean! = false): [__InputValue!]
10911091
ofType: __Type
10921092
isOneOf: Boolean
10931093
}
@@ -1123,7 +1123,7 @@ enum __TypeKind {
11231123
type __Field {
11241124
name: String!
11251125
description: String
1126-
args(includeDeprecated: Boolean = false): [__InputValue!]!
1126+
args(includeDeprecated: Boolean! = false): [__InputValue!]!
11271127
type: __Type!
11281128
isDeprecated: Boolean!
11291129
deprecationReason: String
@@ -1160,7 +1160,7 @@ enum __TypeKind {
11601160
description: String
11611161
isRepeatable: Boolean!
11621162
locations: [__DirectiveLocation!]!
1163-
args(includeDeprecated: Boolean = false): [__InputValue!]!
1163+
args(includeDeprecated: Boolean! = false): [__InputValue!]!
11641164
}
11651165
11661166
"A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies."

0 commit comments

Comments
 (0)