Skip to content

Commit b45e00f

Browse files
committed
Fix fragment sorting (#347)
1 parent 92801a9 commit b45e00f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/GraphQLParser.Tests/Visitors/SDLSorterTests.SortsSchemaDefinition.approved.ExecutableSortTests.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ subscription s3 @dir1 @dir2 @dir3 {
5353
dummy
5454
}
5555

56-
fragment frag2 on Type1 {
56+
fragment frag1 on Type2 {
5757
dummy
5858
}
5959

60-
fragment frag1 on Type2 {
60+
fragment frag2 on Type1 {
6161
dummy
6262
}
6363

src/GraphQLParser/Visitors/SDLSorterOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public virtual int Compare(ASTNode x, ASTNode y)
6363
GraphQLFragmentSpread x => x.FragmentName.Name.Value,
6464
GraphQLRootOperationTypeDefinition x => x.Operation switch { OperationType.Query => "a", OperationType.Mutation => "b", _ => "c" },
6565
GraphQLVariableDefinition x => x.Variable.Name.Value,
66+
GraphQLFragmentDefinition x => x.FragmentName.Name.Value,
6667
_ => "", // do not sort values, comments, etc
6768
};
6869
}

0 commit comments

Comments
 (0)