Skip to content

Commit 686fe3a

Browse files
committed
Update satisfiability
1 parent 428352f commit 686fe3a

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

spec/Section 4 -- Composition.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6200,21 +6200,25 @@ schemas can handle that field at each step.
62006200
- While {queue} is not empty:
62016201
- Dequeue a tuple ({currentType}, {currentPath}, {currentOptions}).
62026202
- If ({currentType}, {currentOptions}) is in {visitedStates}, continue to
6203-
the next tuple in {queue}.
6203+
the next tuple in {queue}. #TODO This does not take into consideration the case where we have already visited this type with a subset of currentOptions.
62046204
- Add ({currentType}, {currentOptions}) to {visitedStates}.
62056205
- Let {fields} be the set of fields on {currentType} in {schema}.
62066206
- For each {field} in {fields}:
62076207
- Let {returnType} be the return type of {field}.
6208-
- For each {possibleType} in {returnType}:
6209-
- Let {newPath} be {currentPath} extended by {field} with
6210-
{possibleType}, for example `<currentPath>.<fieldName><possibleType>`.
6211-
- Let {newOptions} be {PlanOptions(newPath)}
6212-
- If {newOptions} is empty, the schema is unsatisfiable and composition
6213-
fails.
6214-
- If {field} returns a scalar or enum (a leaf type), continue to the
6215-
next {possibleType}.
6216-
- Otherwise, enqueue the tuple ({possibleType}, {newPath}, {newOptions})
6217-
into {queue}.
6208+
- If {returnType} is a leaf type
6209+
- Let {newPath} be {currentPath} extended by {field}, for example `<currentPath>.<fieldName>`.
6210+
- Let {newOptions} be {PlanOptions(newPath)}
6211+
- If {newOptions} is empty, the schema is unsatisfiable and composition
6212+
fails.
6213+
- Otherwise
6214+
- For each {possibleType} in {returnType}:
6215+
- Let {newPath} be {currentPath} extended by {field} with
6216+
{possibleType}, for example `<currentPath>.<fieldName><possibleType>`.
6217+
- Let {newOptions} be {PlanOptions(newPath)}
6218+
- If {newOptions} is empty, the schema is unsatisfiable and composition
6219+
fails.
6220+
- Otherwise, enqueue the tuple ({possibleType}, {newPath}, {newOptions})
6221+
into {queue}.
62186222

62196223
- If the entire process completes for all {roots} without encountering an empty
62206224
{newOptions}, the schema is satisfiable.
@@ -6235,7 +6239,7 @@ type Profile {
62356239
}
62366240

62376241
type User {
6238-
id: ID!
6242+
id: ID! @shareable
62396243
name: String
62406244
}
62416245

@@ -6250,7 +6254,7 @@ type Order {
62506254
}
62516255

62526256
type User {
6253-
id: ID!
6257+
id: ID! @shareable
62546258
membershipStatus: String
62556259
}
62566260
```
@@ -6312,7 +6316,7 @@ sources, but there is no consistent lookup path that includes all required
63126316
fields. While, when the query first retrieves a product from schema Product
63136317
(knowing `sku`) it can move to Inventory via `id`, there is no valid path if the
63146318
query starts from Inventory’s `productById` to Product’s `productByIdSku`.
6315-
{PlanOptions} with `<Query>.productByIdSku<Product>.name` would return an empty
6319+
{PlanOptions} with `<Query>.productById<Product>.name` would return an empty
63166320
set.
63176321

63186322
**Key Mismatch Between Source Schemas:**
@@ -6402,7 +6406,7 @@ type User {
64026406
address: Address
64036407
}
64046408

6405-
type Address {
6409+
type Address @shareable {
64066410
street: String
64076411
city: String
64086412
}
@@ -6417,7 +6421,7 @@ type Order {
64176421
shippingAddress: Address
64186422
}
64196423

6420-
type Address {
6424+
type Address @shareable {
64216425
street: String
64226426
city: String
64236427
country: String
@@ -6481,7 +6485,7 @@ type Query {
64816485
categoryById(id: ID!): Category @lookup
64826486
}
64836487

6484-
type Category {
6488+
type Category @key(fields: "id") {
64856489
id: ID!
64866490
description: String
64876491
}

0 commit comments

Comments
 (0)