Skip to content

Commit 4738de3

Browse files
authored
Added descriptions to executable definitions (#8351)
1 parent 23ee5f3 commit 4738de3

File tree

104 files changed

+2360
-1307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2360
-1307
lines changed

src/HotChocolate/Core/src/Execution/Processing/OperationPrinter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public static string Print(Operation operation)
4646
var operationDefinition = new OperationDefinitionNode(
4747
operation.Definition.Location,
4848
operation.Definition.Name,
49+
operation.Definition.Description,
4950
operation.Definition.Operation,
5051
operation.Definition.VariableDefinitions,
5152
directives,
@@ -82,6 +83,7 @@ private static SelectionSetNode Visit(PrintContext context)
8283
new FragmentDefinitionNode(
8384
null,
8485
new(fragmentName),
86+
description: null,
8587
Array.Empty<VariableDefinitionNode>(),
8688
new NamedTypeNode(typeContext.Name),
8789
Array.Empty<DirectiveNode>(),

src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/OperationRequestBuilderTests.BuildRequest_OnlyQueryDocIsSet_RequestHasOnlyQuery.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"Column": 1
1919
},
2020
"Name": null,
21+
"Description": null,
2122
"Operation": "Query",
2223
"VariableDefinitions": [],
2324
"Directives": [],

src/HotChocolate/Core/test/Execution.Abstractions.Tests/Execution/__snapshots__/OperationRequestBuilderTests.BuildRequest_OnlyQueryDocIsSet_RequestHasOnlyQuery.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"Column": 1
1919
},
2020
"Name": null,
21+
"Description": null,
2122
"Operation": "Query",
2223
"VariableDefinitions": [],
2324
"Directives": [],

src/HotChocolate/Core/test/Execution.Tests/Processing/VariableCoercionHelperTests.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public void VariableCoercionHelper_Schema_Is_Null()
1717
{
1818
new(null,
1919
new VariableNode("abc"),
20+
description: null,
2021
new NamedTypeNode("String"),
2122
new StringValueNode("def"),
2223
Array.Empty<DirectiveNode>())
@@ -63,6 +64,7 @@ public void VariableCoercionHelper_VariableValues_Is_Null()
6364
new VariableDefinitionNode(
6465
null,
6566
new VariableNode("abc"),
67+
description: null,
6668
new NamedTypeNode("String"),
6769
new StringValueNode("def"),
6870
Array.Empty<DirectiveNode>())
@@ -90,6 +92,7 @@ public void VariableCoercionHelper_CoercedValues_Is_Null()
9092
new VariableDefinitionNode(
9193
null,
9294
new VariableNode("abc"),
95+
description: null,
9396
new NamedTypeNode("String"),
9497
new StringValueNode("def"),
9598
Array.Empty<DirectiveNode>())
@@ -118,6 +121,7 @@ public void Coerce_Nullable_String_Variable_With_Default_Where_Value_Is_Not_Prov
118121
new VariableDefinitionNode(
119122
null,
120123
new VariableNode("abc"),
124+
description: null,
121125
new NamedTypeNode("String"),
122126
new StringValueNode("def"),
123127
Array.Empty<DirectiveNode>())
@@ -153,6 +157,7 @@ public void Coerce_Nullable_String_Variable_Where_Value_Is_Not_Provided()
153157
new VariableDefinitionNode(
154158
null,
155159
new VariableNode("abc"),
160+
description: null,
156161
new NamedTypeNode("String"),
157162
null,
158163
Array.Empty<DirectiveNode>())
@@ -181,6 +186,7 @@ public void Coerce_Nullable_String_Variable_With_Default_Where_Value_Is_Provided
181186
new VariableDefinitionNode(
182187
null,
183188
new VariableNode("abc"),
189+
description: null,
184190
new NamedTypeNode("String"),
185191
new StringValueNode("def"),
186192
Array.Empty<DirectiveNode>())
@@ -220,6 +226,7 @@ public void Coerce_Nullable_String_Variable_With_Default_Where_Plain_Value_Is_Pr
220226
new VariableDefinitionNode(
221227
null,
222228
new VariableNode("abc"),
229+
description: null,
223230
new NamedTypeNode("String"),
224231
new StringValueNode("def"),
225232
Array.Empty<DirectiveNode>())
@@ -259,6 +266,7 @@ public void Coerce_Nullable_String_Variable_With_Default_Where_Null_Is_Provided(
259266
new VariableDefinitionNode(
260267
null,
261268
new VariableNode("abc"),
269+
description: null,
262270
new NamedTypeNode("String"),
263271
new StringValueNode("def"),
264272
Array.Empty<DirectiveNode>())
@@ -297,6 +305,7 @@ public void Coerce_Nullable_String_Variable_With_Default_Where_Plain_Null_Is_Pro
297305
new VariableDefinitionNode(
298306
null,
299307
new VariableNode("abc"),
308+
description: null,
300309
new NamedTypeNode("String"),
301310
new StringValueNode("def"),
302311
Array.Empty<DirectiveNode>())
@@ -335,6 +344,7 @@ public void Coerce_Nullable_ReviewInput_Variable_With_Object_Literal()
335344
new VariableDefinitionNode(
336345
null,
337346
new VariableNode("abc"),
347+
description: null,
338348
new NamedTypeNode("ReviewInput"),
339349
new StringValueNode("def"),
340350
Array.Empty<DirectiveNode>())
@@ -373,6 +383,7 @@ public void Coerce_Nullable_ReviewInput_Variable_With_Dictionary()
373383
new VariableDefinitionNode(
374384
null,
375385
new VariableNode("abc"),
386+
description: null,
376387
new NamedTypeNode("ReviewInput"),
377388
new StringValueNode("def"),
378389
Array.Empty<DirectiveNode>())
@@ -411,6 +422,7 @@ public void Coerce_Nullable_ReviewInput_Variable_With_Review_Object()
411422
new VariableDefinitionNode(
412423
null,
413424
new VariableNode("abc"),
425+
description: null,
414426
new NamedTypeNode("ReviewInput"),
415427
new StringValueNode("def"),
416428
Array.Empty<DirectiveNode>())
@@ -449,6 +461,7 @@ public void Error_When_Value_Is_Null_On_Non_Null_Variable()
449461
new VariableDefinitionNode(
450462
null,
451463
new VariableNode("abc"),
464+
description: null,
452465
new NonNullTypeNode(new NamedTypeNode("String")),
453466
new StringValueNode("def"),
454467
Array.Empty<DirectiveNode>())
@@ -481,6 +494,7 @@ public void Error_When_PlainValue_Is_Null_On_Non_Null_Variable()
481494
new VariableDefinitionNode(
482495
null,
483496
new VariableNode("abc"),
497+
description: null,
484498
new NonNullTypeNode(new NamedTypeNode("String")),
485499
new StringValueNode("def"),
486500
Array.Empty<DirectiveNode>())
@@ -513,6 +527,7 @@ public void Error_When_Value_Type_Does_Not_Match_Variable_Type()
513527
new VariableDefinitionNode(
514528
null,
515529
new VariableNode("abc"),
530+
description: null,
516531
new NamedTypeNode("String"),
517532
new StringValueNode("def"),
518533
Array.Empty<DirectiveNode>())
@@ -547,6 +562,7 @@ public void Error_When_PlainValue_Type_Does_Not_Match_Variable_Type()
547562
{
548563
new(null,
549564
new VariableNode("abc"),
565+
description: null,
550566
new NamedTypeNode("String"),
551567
new StringValueNode("def"),
552568
Array.Empty<DirectiveNode>())
@@ -578,6 +594,7 @@ public void Variable_Type_Is_Not_An_Input_Type()
578594
{
579595
new(null,
580596
new VariableNode("abc"),
597+
description: null,
581598
new NamedTypeNode("Human"),
582599
new StringValueNode("def"),
583600
Array.Empty<DirectiveNode>())
@@ -609,6 +626,7 @@ public void Error_When_Input_Field_Has_Different_Properties_Than_Defined()
609626
{
610627
new(null,
611628
new VariableNode("abc"),
629+
description: null,
612630
new NamedTypeNode("ReviewInput"),
613631
new StringValueNode("def"),
614632
Array.Empty<DirectiveNode>())
@@ -659,6 +677,7 @@ enum TestEnum {
659677
{
660678
new(null,
661679
new VariableNode("abc"),
680+
description: null,
662681
new ListTypeNode(new NamedTypeNode("FooInput")),
663682
null,
664683
Array.Empty<DirectiveNode>())
@@ -720,6 +739,7 @@ enum TestEnum {
720739
{
721740
new(null,
722741
new VariableNode("abc"),
742+
description: null,
723743
new ListTypeNode(new NamedTypeNode("FooInput")),
724744
null,
725745
Array.Empty<DirectiveNode>())
@@ -782,6 +802,7 @@ enum TestEnum {
782802
{
783803
new(null,
784804
new VariableNode("abc"),
805+
description: null,
785806
new NamedTypeNode("FooInput"),
786807
null,
787808
Array.Empty<DirectiveNode>())
@@ -840,6 +861,7 @@ enum TestEnum {
840861
{
841862
new(null,
842863
new VariableNode("abc"),
864+
description: null,
843865
new NamedTypeNode("FooInput"),
844866
null,
845867
Array.Empty<DirectiveNode>())
@@ -898,6 +920,7 @@ enum TestEnum {
898920
{
899921
new(null,
900922
new VariableNode("abc"),
923+
description: null,
901924
new NamedTypeNode("FooInput"),
902925
null,
903926
Array.Empty<DirectiveNode>())
@@ -965,6 +988,7 @@ enum TestEnum {
965988
{
966989
new(null,
967990
new VariableNode("abc"),
991+
description: null,
968992
new ListTypeNode(new NamedTypeNode("FooInput")),
969993
null,
970994
Array.Empty<DirectiveNode>())
@@ -1013,6 +1037,7 @@ public void Variable_Is_Nullable_And_Not_Set()
10131037
{
10141038
new(null,
10151039
new VariableNode("abc"),
1040+
description: null,
10161041
new NamedTypeNode("String"),
10171042
null,
10181043
Array.Empty<DirectiveNode>())

src/HotChocolate/Core/test/Execution.Tests/Processing/__snapshots__/OperationCompilerTests.CompositeType_SelectionsSet_Empty.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
query foo($v: Boolean) {
1+
query foo(
2+
$v: Boolean
3+
) {
24
hero(episode: EMPIRE) {
35

46
}
57
}
68

79
---------------------------------------------------------
810

9-
query foo($v: Boolean) {
11+
query foo(
12+
$v: Boolean
13+
) {
1014
... on Query {
1115
hero(episode: EMPIRE) @__execute(id: 0, kind: PURE, type: COMPOSITE) {
1216
... on Droid {

src/HotChocolate/Core/test/Execution.Tests/Processing/__snapshots__/OperationCompilerTests.Crypto_Details_Test.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
query ViewerContainerQuery($symbol: String!) {
1+
query ViewerContainerQuery(
2+
$symbol: String!
3+
) {
24
assetBySymbol(symbol: $symbol) {
35
... ViewerHeaderFragment_asset
46
... ViewerSnapshotFragment_asset
@@ -68,7 +70,9 @@ fragment ViewerStatsFragment_asset on Asset {
6870

6971
---------------------------------------------------------
7072

71-
query ViewerContainerQuery($symbol: String!) {
73+
query ViewerContainerQuery(
74+
$symbol: String!
75+
) {
7276
... on Query {
7377
assetBySymbol(symbol: $symbol) @__execute(id: 0, kind: DEFAULT, type: COMPOSITE) {
7478
... on Asset {

src/HotChocolate/Core/test/Execution.Tests/Processing/__snapshots__/OperationCompilerTests.Field_Is_Visible_When_One_Selection_Is_Visible_1.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
query foo($v: Boolean!) {
1+
query foo(
2+
$v: Boolean!
3+
) {
24
hero(episode: EMPIRE) {
35
name
46
... abc @include(if: $v)
@@ -11,7 +13,9 @@ fragment abc on Droid {
1113

1214
---------------------------------------------------------
1315

14-
query foo($v: Boolean!) @includeCondition(flag: 2) {
16+
query foo(
17+
$v: Boolean!
18+
) @includeCondition(flag: 2) {
1519
... on Query {
1620
hero(episode: EMPIRE) @__execute(id: 0, kind: PURE, type: COMPOSITE) {
1721
... on Droid {

src/HotChocolate/Core/test/Execution.Tests/Processing/__snapshots__/OperationCompilerTests.Field_Is_Visible_When_One_Selection_Is_Visible_2.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
query foo($v: Boolean!) {
1+
query foo(
2+
$v: Boolean!
3+
) {
24
hero(episode: EMPIRE) {
35
name @include(if: $v)
46
... abc
@@ -11,7 +13,9 @@ fragment abc on Droid {
1113

1214
---------------------------------------------------------
1315

14-
query foo($v: Boolean!) @includeCondition(flag: 2) {
16+
query foo(
17+
$v: Boolean!
18+
) @includeCondition(flag: 2) {
1519
... on Query {
1620
hero(episode: EMPIRE) @__execute(id: 0, kind: PURE, type: COMPOSITE) {
1721
... on Droid {

src/HotChocolate/Core/test/Execution.Tests/Processing/__snapshots__/OperationCompilerTests.Field_Is_Visible_When_One_Selection_Is_Visible_3.snap

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
query foo($v: Boolean!, $q: Boolean!) {
1+
query foo(
2+
$v: Boolean!
3+
$q: Boolean!
4+
) {
25
hero(episode: EMPIRE) {
36
name @include(if: $v)
47
... abc @include(if: $q)
@@ -11,7 +14,10 @@ fragment abc on Droid {
1114

1215
---------------------------------------------------------
1316

14-
query foo($v: Boolean!, $q: Boolean!) @includeCondition(flag: 2) @includeCondition(flag: 3) {
17+
query foo(
18+
$v: Boolean!
19+
$q: Boolean!
20+
) @includeCondition(flag: 2) @includeCondition(flag: 3) {
1521
... on Query {
1622
hero(episode: EMPIRE) @__execute(id: 0, kind: PURE, type: COMPOSITE) {
1723
... on Droid {

src/HotChocolate/Core/test/Execution.Tests/Processing/__snapshots__/OperationCompilerTests.Field_Is_Visible_When_One_Selection_Is_Visible_4.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
query foo($v: Boolean!) {
1+
query foo(
2+
$v: Boolean!
3+
) {
24
hero(episode: EMPIRE) {
35
name @include(if: $v)
46
... abc
@@ -14,7 +16,9 @@ fragment abc on Droid {
1416

1517
---------------------------------------------------------
1618

17-
query foo($v: Boolean!) @includeCondition(flag: 2) {
19+
query foo(
20+
$v: Boolean!
21+
) @includeCondition(flag: 2) {
1822
... on Query {
1923
hero(episode: EMPIRE) @__execute(id: 0, kind: PURE, type: COMPOSITE) {
2024
... on Droid {

0 commit comments

Comments
 (0)