-
Notifications
You must be signed in to change notification settings - Fork 13
adds first version of satisfiability #185
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for composite-schemas ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
# Schema ProductIndex | ||
type Query { | ||
productById(id: ID!): Product @lookup | ||
productBySku(sku: ID!): Product @lookup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
productBySku(sku: ID!): Product @lookup | |
productBySku(sku: String!): Product @lookup |
``` | ||
|
||
will attempt to retrieve `country` from User’s version of `Address`. But because | ||
`Address` is not an entity, there is no `@lookup` to fetch that field to schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`Address` is not an entity, there is no `@lookup` to fetch that field to schema | |
`Address` is not an entity, there is no `@lookup` to fetch that field from schema |
To resolve this, both schemas would need to align on the `Address` type either | ||
both define `country` or neither does or turn `Address` into an entity with some | ||
form of bridging lookup. As it stands, the mismatch in value-type fields across |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest reworking this sentence. Seems awkward.
|
||
In the Products schema, `Category` is simply a nested value type. There is no | ||
`@lookup` field or key to identify it, and `Product.category` does not provide | ||
an ID or other identifier. By contrast, the Categories schema, treats `Category` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an ID or other identifier. By contrast, the Categories schema, treats `Category` | |
an ID or other identifier. By contrast, the Categories schema treats `Category` |
Product schema (including its `Category`), but this schema never provides an ID | ||
for that category. In effect, the executor cannot lookup the `Category` from the | ||
categories schema, so that `description` can be fetched. The result of | ||
{PlantOptions()} with `<Query>.productById<Product>.category<Category>.name` is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{PlantOptions()} with `<Query>.productById<Product>.category<Category>.name` is | |
{PlanOptions()} with `<Query>.productById<Product>.category<Category>.name` is |
It is not required that every schema define a `@lookup` for a shared entity as | ||
long all fields are covered by a schema that has a lookup. In the example below, | ||
the `Order` schema references `User` but does not provide a `@lookup` for it. | ||
Instead, it marks the `User.id` field as `@shareable` (or could have used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The User.id
field is not marked as @shareable
.
Co-authored-by: Glen <glen.84@gmail.com>
Co-authored-by: Glen <glen.84@gmail.com>
Co-authored-by: Glen <glen.84@gmail.com>
** Entity vs. Value Type Conflict** | ||
|
||
```graphql counter-example | ||
## Schema Products |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Schema Products | |
# Schema Products |
name: String | ||
} | ||
|
||
### Schema Categories |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Schema Categories | |
# Schema Categories |
for that entity. | ||
|
||
```graphql | ||
# Schema: Order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Schema: Order | |
# Schema Order |
name: String | ||
} | ||
|
||
# Schema: User |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Schema: User | |
# Schema User |
Adds a first version of satisfiability