-
Notifications
You must be signed in to change notification settings - Fork 43
Add SDLSorter #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add SDLSorter #327
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
scalar Type3 | ||
|
||
schema { | ||
mutation: Type2 | ||
query: Type3 | ||
subscription: Type1 | ||
} | ||
|
||
type Type1 @dir3 @dir1 @dir2 { | ||
f1(arg3: [ID], arg1: Float, arg2: Int!): String | ||
f3: ID | ||
f2: Float | ||
} | ||
|
||
# Type2 comment | ||
"Type2 description" | ||
input Type2 { | ||
"f1 description" | ||
f1: String | ||
"f3 description" | ||
f3: ID! | ||
"f2 description" | ||
f2: [[Float!]!]! | ||
} | ||
|
||
directive @zdir3(arg3: [ID], arg1: Float, arg2: Int!) | ||
on FRAGMENT_SPREAD | FIELD | INLINE_FRAGMENT | ||
|
||
directive @zdir1 on FIELD | ||
|
||
directive @zdir2 on INLINE_FRAGMENT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
mutation m2 { | ||
field | ||
} | ||
|
||
# comments for q2 | ||
query q2 { | ||
dummy | ||
} | ||
|
||
subscription s3 @dir3 @dir1 @dir2 { | ||
dummy | ||
} | ||
|
||
mutation m1 { | ||
field | ||
} | ||
|
||
subscription s1 { | ||
dummy | ||
} | ||
|
||
# l2 - comments on default query line 1 | ||
# l1 - comments on default query line 2 | ||
# l3 - comments on default query line 3 | ||
{ | ||
...fragment8 | ||
field2 | ||
... on Type2 { | ||
field5 | ||
} | ||
...fragment7 | ||
field1 (arg2: "value1", arg1: [3, 1, 2], arg3: { sub2: 1, sub1: 2, sub3: 3 }) | ||
... { | ||
field4 | ||
} | ||
field3 @dir2 @dir1(arg2: "value1", arg1: [3, 1, 2], arg3: { sub2: 1, sub1: 2, sub3: 3 }) @dir3 | ||
...fragment9 | ||
... on Type3 { | ||
field6 | ||
} | ||
} | ||
|
||
fragment frag2 on Type1 { | ||
dummy | ||
} | ||
|
||
fragment frag1 on Type2 { | ||
dummy | ||
} | ||
|
||
mutation m3 { | ||
field | ||
} | ||
|
||
fragment frag3 on Type3 { | ||
dummy3 | ||
dummy1 | ||
dummy2 | ||
} | ||
|
||
subscription s2 { | ||
dummy | ||
} | ||
|
||
# comments for q3 | ||
query q3 ($arg2: ID, $arg1: String, $arg3: Float) { | ||
dummy | ||
} |
33 changes: 33 additions & 0 deletions
33
....Tests/Visitors/SDLSorterTests.SortsSchemaDefinition.approved.DefinitionSortTests.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
schema { | ||
query: Type3 | ||
mutation: Type2 | ||
subscription: Type1 | ||
} | ||
|
||
directive @zdir1 on FIELD | ||
|
||
directive @zdir2 on INLINE_FRAGMENT | ||
|
||
directive @zdir3(arg1: Float, arg2: Int!, arg3: [ID]) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
type Type1 @dir1 @dir2 @dir3 { | ||
f1(arg1: Float, arg2: Int!, arg3: [ID]): String | ||
f2: Float | ||
f3: ID | ||
} | ||
|
||
# Type2 comment | ||
"Type2 description" | ||
input Type2 { | ||
|
||
"f1 description" | ||
f1: String | ||
|
||
"f2 description" | ||
f2: [[Float!]!]! | ||
|
||
"f3 description" | ||
f3: ID! | ||
Comment on lines
+23
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broken indentation. |
||
} | ||
|
||
scalar Type3 |
68 changes: 68 additions & 0 deletions
68
....Tests/Visitors/SDLSorterTests.SortsSchemaDefinition.approved.ExecutableSortTests.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# l2 - comments on default query line 1 | ||
# l1 - comments on default query line 2 | ||
# l3 - comments on default query line 3 | ||
{ | ||
field1(arg1: [3, 1, 2], arg2: "value1", arg3: {sub1: 2, sub2: 1, sub3: 3}) | ||
field2 | ||
field3 @dir1(arg1: [3, 1, 2], arg2: "value1", arg3: {sub1: 2, sub2: 1, sub3: 3}) @dir2 @dir3 | ||
... { | ||
field4 | ||
} | ||
... on Type2 { | ||
field5 | ||
} | ||
... on Type3 { | ||
field6 | ||
} | ||
...fragment7 | ||
...fragment8 | ||
...fragment9 | ||
} | ||
|
||
# comments for q2 | ||
query q2 { | ||
dummy | ||
} | ||
|
||
# comments for q3 | ||
query q3($arg1: String, $arg2: ID, $arg3: Float) { | ||
dummy | ||
} | ||
|
||
mutation m1 { | ||
field | ||
} | ||
|
||
mutation m2 { | ||
field | ||
} | ||
|
||
mutation m3 { | ||
field | ||
} | ||
|
||
subscription s1 { | ||
dummy | ||
} | ||
|
||
subscription s2 { | ||
dummy | ||
} | ||
|
||
subscription s3 @dir1 @dir2 @dir3 { | ||
dummy | ||
} | ||
|
||
fragment frag2 on Type1 { | ||
dummy | ||
} | ||
|
||
fragment frag1 on Type2 { | ||
dummy | ||
} | ||
sungam3r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
fragment frag3 on Type3 { | ||
dummy1 | ||
dummy2 | ||
dummy3 | ||
} |
142 changes: 142 additions & 0 deletions
142
...QLParser.Tests/Visitors/SDLSorterTests.SortsSchemaDefinition.approved.KitchenSink.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
query | ||
unnamed(falsey: false, truthy: true) | ||
} | ||
|
||
# Copyright (c) 2015, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
query queryName($foo: ComplexType, $site: Site = MOBILE) { | ||
whoever123is: node(id: [123, 456]) { | ||
id | ||
... @skip(unless: $foo) { | ||
sungam3r marked this conversation as resolved.
Show resolved
Hide resolved
|
||
id | ||
} | ||
... { | ||
id | ||
} | ||
... on User @defer { | ||
field2 { | ||
alias: field1(after: $foo, first: 10) @include(if: $foo) { | ||
id | ||
...frag | ||
} | ||
id | ||
} | ||
} | ||
} | ||
} | ||
|
||
mutation likeStory { | ||
like(story: 123) @defer { | ||
story { | ||
id | ||
} | ||
} | ||
} | ||
|
||
mutation updateStory { | ||
like(story: {EndDate: null, id: 123}) { | ||
story { | ||
id | ||
} | ||
} | ||
} | ||
|
||
subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) { | ||
storyLikeSubscribe(input: $input) { | ||
story { | ||
likers { | ||
count | ||
} | ||
likeSentence { | ||
text | ||
} | ||
} | ||
} | ||
} | ||
|
||
fragment frag on Friend { | ||
foo(bar: $b, obj: {key: "value"}, size: $size) | ||
} | ||
|
||
# Copyright (c) 2015, Facebook, Inc. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. An additional grant | ||
# of patent rights can be found in the PATENTS file in the same directory. | ||
schema { | ||
query: QueryType | ||
mutation: MutationType | ||
} | ||
|
||
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
enum AnnotatedEnum @onEnum { | ||
ANNOTATED_VALUE @onEnumValue | ||
OTHER_VALUE | ||
} | ||
|
||
input AnnotatedInput @onInputObjectType { | ||
annotatedField: Type @onField | ||
} | ||
|
||
interface AnnotatedInterface @onInterface { | ||
annotatedField(arg: Type @onArg): Type @onField | ||
} | ||
|
||
type AnnotatedObject @onObject(arg: "value") { | ||
# a comment | ||
annotatedField(arg: Type = "default" @onArg): Type @onField | ||
} | ||
|
||
scalar AnnotatedScalar @onScalar | ||
|
||
union AnnotatedUnion @onUnion = A | B | ||
|
||
interface Bar { | ||
four(argument: String = "string"): String | ||
one: Type | ||
} | ||
|
||
scalar CustomScalar | ||
|
||
union Feed = Advert | Article | Story | ||
|
||
type Foo implements Bar { | ||
five(argument: [String] = ["string", "string"]): String | ||
four(argument: String = "string"): String | ||
# comment 1 | ||
one: Type | ||
six(argument: InputType = {key: "value"}): Type | ||
# multiline comments | ||
# with very important description # | ||
# # and symbol # and ## | ||
three(argument: InputType, other: String): Int | ||
# comment 2 | ||
two(argument: InputType!): Type | ||
} | ||
|
||
input InputType { | ||
answer: Int = 42 | ||
key: String! | ||
} | ||
|
||
type NoFields | ||
|
||
enum Site { | ||
DESKTOP | ||
MOBILE | ||
} | ||
|
||
extend type Foo { | ||
seven(argument: [String]): Type | ||
} | ||
|
||
extend type Foo @onType |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.