Skip to content

Commit

Permalink
fix(graphql/SchemaPrinter): Directives location for enum.
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDragon-ru committed Dec 24, 2022
1 parent 1c1b718 commit 581be04
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ protected function type(): string {
}

protected function body(int $used): Block|string|null {
return null;
}

protected function fields(int $used): Block|string|null {
$space = $this->space();
$values = $this->addUsed(
new EnumValuesDefinitionList(
Expand All @@ -38,10 +42,6 @@ protected function body(int $used): Block|string|null {
),
);

return "{$space}{$values}";
}

protected function fields(int $used): Block|string|null {
return null;
return $values;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,27 @@ enum Test {
'values' => ['C', 'B', 'A'],
]),
],
'directives' => [
<<<'STRING'
enum Test
@a
{
A
}
STRING,
$settings,
0,
0,
new EnumType([
'name' => 'Test',
'values' => ['A'],
'astNode' => Parser::enumTypeDefinition(
<<<'STRING'
enum Test @a { A }
STRING,
),
]),
],
];
}
// </editor-fold>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ directive @schemaDirective(

scalar SchemaScalar @scalar(class: "GraphQL\\Type\\Definition\\StringType") @codeDirective

enum SchemaEnum {
enum SchemaEnum @schemaDirective @codeDirective {
A @deprecated

"Description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ enum CodeEnum {
C
}

enum SchemaEnum {
enum SchemaEnum
@schemaDirective
@codeDirective
{
A
@deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ enum CodeEnum {
C
}

enum SchemaEnum {
enum SchemaEnum
@schemaDirective
@codeDirective
{
A
@deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ enum CodeEnum {
C
}

enum SchemaEnum {
enum SchemaEnum
@schemaDirective
@codeDirective
{
A
@deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ represent free-form human-readable text.
"""
scalar CodeScalar

enum SchemaEnum {
enum SchemaEnum
@schemaDirective
@codeDirective
{
A
@deprecated

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
enum SchemaEnum {
enum SchemaEnum
@schemaDirective
@codeDirective
{
A
@deprecated

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ enum CodeEnum {
C
}

enum SchemaEnum {
enum SchemaEnum
@schemaDirective
@codeDirective
{
A
@deprecated

Expand Down

0 comments on commit 581be04

Please sign in to comment.