Skip to content

Commit 7d5eafd

Browse files
committed
INPUT_OBJECT support.
1 parent 7327a77 commit 7d5eafd

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/Utils/SchemaPrinter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ static function ($f, $i) use ($options): string {
503503

504504
return static::printDescription($options, $type) .
505505
sprintf('input %s', $type->name) .
506+
static::printTypeDirectives($type, $options) .
506507
static::printBlock($fields);
507508
}
508509

@@ -517,7 +518,7 @@ protected static function printBlock(array $items): string
517518
}
518519

519520
/**
520-
* @param Type|EnumValueDefinition|EnumType|InterfaceType|FieldDefinition|UnionType $type
521+
* @param Type|EnumValueDefinition|EnumType|InterfaceType|FieldDefinition|UnionType|InputObjectType $type
521522
* @param array<string, bool> $options
522523
* @phpstan-param Options $options
523524
*/

tests/Utils/SchemaPrinterTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,14 @@ interface InterfaceB implements InterfaceA @test(value: "{$text}") {
13391339
union UnionA @test = TypeA | TypeB
13401340
13411341
union UnionB @test(value: "{$text}") = TypeA | TypeB
1342+
1343+
input InputA @test {
1344+
a: Int
1345+
}
1346+
1347+
input InputB @test(value: "{$text}") {
1348+
a: ID
1349+
}
13421350
GRAPHQL;
13431351
$expected = /** @lang GraphQL */ <<<'GRAPHQL'
13441352
directive @test(value: String) on SCHEMA | SCALAR | OBJECT | FIELD_DEFINITION | ARGUMENT_DEFINITION | INTERFACE | UNION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
@@ -1367,6 +1375,15 @@ enum EnumB
13671375
a
13681376
}
13691377
1378+
input InputA @test {
1379+
a: Int
1380+
}
1381+
1382+
input InputB
1383+
@test(value: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") {
1384+
a: ID
1385+
}
1386+
13701387
interface InterfaceA @test {
13711388
a: Int @test @deprecated
13721389

0 commit comments

Comments
 (0)