-
-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f42fe7c
commit bbb93f8
Showing
8 changed files
with
132 additions
and
10 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
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
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
82 changes: 82 additions & 0 deletions
82
.../Core.Tests/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserById.snap
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,82 @@ | ||
User Request | ||
--------------- | ||
query GetUser { | ||
userById(id: 1) { | ||
id | ||
} | ||
} | ||
--------------- | ||
|
||
QueryPlan | ||
--------------- | ||
{ | ||
"document": "query GetUser { userById(id: 1) { id } }", | ||
"operation": "GetUser", | ||
"rootNode": { | ||
"type": "Serial", | ||
"nodes": [ | ||
{ | ||
"type": "Resolver", | ||
"schemaName": "Reviews", | ||
"document": "query GetUser_1 { userById: authorById(id: 1) { id } }", | ||
"selectionSetId": 0 | ||
}, | ||
{ | ||
"type": "Composition", | ||
"selectionSetIds": [ | ||
0 | ||
] | ||
} | ||
] | ||
} | ||
} | ||
--------------- | ||
|
||
Result | ||
--------------- | ||
{ | ||
"data": { | ||
"userById": { | ||
"id": 1 | ||
} | ||
} | ||
} | ||
--------------- | ||
|
||
Fusion Graph | ||
--------------- | ||
schema @fusion(version: 1) @httpClient(subgraph: "Reviews", baseAddress: "http:\/\/localhost:5000\/graphql") @httpClient(subgraph: "Accounts", baseAddress: "http:\/\/localhost:5000\/graphql") { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
productById(upc: Int!): Product! @variable(subgraph: "Reviews", name: "upc", argument: "upc") @resolver(subgraph: "Reviews", select: "{ productById(upc: $upc) }", arguments: [ { name: "upc", type: "Int!" } ]) | ||
reviews: [Review!]! @resolver(subgraph: "Reviews", select: "{ reviews }") | ||
userById(id: Int!): User! @variable(subgraph: "Reviews", name: "id", argument: "id") @resolver(subgraph: "Reviews", select: "{ authorById(id: $id) }", arguments: [ { name: "id", type: "Int!" } ]) @variable(subgraph: "Accounts", name: "id", argument: "id") @resolver(subgraph: "Accounts", select: "{ userById(id: $id) }", arguments: [ { name: "id", type: "Int!" } ]) | ||
users: [User!]! @resolver(subgraph: "Accounts", select: "{ users }") | ||
usersById(ids: [Int!]!): [User!]! @variable(subgraph: "Accounts", name: "ids", argument: "ids") @resolver(subgraph: "Accounts", select: "{ usersById(ids: $ids) }", arguments: [ { name: "ids", type: "[Int!]!" } ]) | ||
} | ||
|
||
type Product @variable(subgraph: "Reviews", name: "Product_upc", select: "upc") @resolver(subgraph: "Reviews", select: "{ productById(upc: $Product_upc) }", arguments: [ { name: "Product_upc", type: "Int!" } ]) { | ||
reviews: [Review!]! @source(subgraph: "Reviews") | ||
upc: Int! @source(subgraph: "Reviews") | ||
} | ||
|
||
type Review { | ||
author: User! @source(subgraph: "Reviews") | ||
body: String! @source(subgraph: "Reviews") | ||
id: Int! @source(subgraph: "Reviews") | ||
product: Product! @source(subgraph: "Reviews") | ||
} | ||
|
||
type User @source(subgraph: "Reviews", name: "Author") @variable(subgraph: "Reviews", name: "User_id", select: "id") @variable(subgraph: "Accounts", name: "User_id", select: "id") @resolver(subgraph: "Reviews", select: "{ authorById(id: $User_id) }", arguments: [ { name: "User_id", type: "Int!" } ]) @resolver(subgraph: "Accounts", select: "{ userById(id: $User_id) }", arguments: [ { name: "User_id", type: "Int!" } ]) @resolver(subgraph: "Accounts", select: "{ usersById(ids: $User_id) }", arguments: [ { name: "User_id", type: "[Int!]!" } ], kind: "BATCH_BY_KEY") { | ||
birthdate: DateTime! @source(subgraph: "Accounts") | ||
id: Int! @source(subgraph: "Reviews") @source(subgraph: "Accounts") | ||
name: String! @source(subgraph: "Reviews") @source(subgraph: "Accounts") | ||
reviews: [Review!]! @source(subgraph: "Reviews") | ||
username: String! @source(subgraph: "Accounts") | ||
} | ||
|
||
"The `DateTime` scalar represents an ISO-8601 compliant date time type." | ||
scalar DateTime | ||
--------------- |
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 |
---|---|---|
|
@@ -23,5 +23,4 @@ public IEnumerable<User> GetUsersById( | |
} | ||
} | ||
} | ||
|
||
} |