-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
validate @connection filters argument
Reviewed By: josephsavona Differential Revision: D45989512 fbshipit-source-id: 6b7f48312d762c8698b9cfdeefe2d5fe206688f1
- Loading branch information
1 parent
423d6ba
commit 2dd7954
Showing
7 changed files
with
156 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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
27 changes: 27 additions & 0 deletions
27
...y-transforms/tests/validate_connections/fixtures/connection-filters-not-a-string.expected
This file contains 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,27 @@ | ||
==================================== INPUT ==================================== | ||
# expected-to-throw | ||
query NodeQuery($id: ID!, $orderBy: String) { | ||
node(id: $id) { | ||
id | ||
... on Story { | ||
comments(first: 10, orderby: $orderBy) | ||
@connection(key: "NodeQuery_comments", filters: [123]) { | ||
edges { | ||
node { | ||
actor { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
==================================== ERROR ==================================== | ||
✖︎ Expected a value of type 'String' | ||
|
||
connection-filters-not-a-string.graphql:7:58 | ||
6 │ comments(first: 10, orderby: $orderBy) | ||
7 │ @connection(key: "NodeQuery_comments", filters: [123]) { | ||
│ ^^^ | ||
8 │ edges { |
18 changes: 18 additions & 0 deletions
18
...ay-transforms/tests/validate_connections/fixtures/connection-filters-not-a-string.graphql
This file contains 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,18 @@ | ||
# expected-to-throw | ||
query NodeQuery($id: ID!, $orderBy: String) { | ||
node(id: $id) { | ||
id | ||
... on Story { | ||
comments(first: 10, orderby: $orderBy) | ||
@connection(key: "NodeQuery_comments", filters: [123]) { | ||
edges { | ||
node { | ||
actor { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...lay-transforms/tests/validate_connections/fixtures/connection-filters-not-an-arg.expected
This file contains 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,35 @@ | ||
==================================== INPUT ==================================== | ||
# expected-to-throw | ||
|
||
query NodeQuery($id: ID!, $ordering: String) { | ||
node(id: $id) { | ||
id | ||
... on Story { | ||
comments(first: 10, orderby: $ordering) | ||
@connection(key: "NodeQuery_comments", filters: ["ordering"]) { | ||
edges { | ||
node { | ||
actor { | ||
name | ||
friends(first: 10) @connection(key: "NodeQuery_friends") { | ||
edges { | ||
node { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
==================================== ERROR ==================================== | ||
✖︎ Expected the `filters` argument to `@connection` to be a list of argument names to the connection field to use to identify the connection, got `ordering`. Not specifying `filters` is often recommended and will use all fields. | ||
|
||
connection-filters-not-an-arg.graphql:8:57 | ||
7 │ comments(first: 10, orderby: $ordering) | ||
8 │ @connection(key: "NodeQuery_comments", filters: ["ordering"]) { | ||
│ ^^^^^^^^^^^^ | ||
9 │ edges { |
26 changes: 26 additions & 0 deletions
26
...elay-transforms/tests/validate_connections/fixtures/connection-filters-not-an-arg.graphql
This file contains 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,26 @@ | ||
# expected-to-throw | ||
|
||
query NodeQuery($id: ID!, $ordering: String) { | ||
node(id: $id) { | ||
id | ||
... on Story { | ||
comments(first: 10, orderby: $ordering) | ||
@connection(key: "NodeQuery_comments", filters: ["ordering"]) { | ||
edges { | ||
node { | ||
actor { | ||
name | ||
friends(first: 10) @connection(key: "NodeQuery_friends") { | ||
edges { | ||
node { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains 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