Skip to content

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

PascalSenn
Copy link
Contributor

@PascalSenn PascalSenn commented Apr 9, 2025

Adds a first version of satisfiability

Copy link

netlify bot commented Apr 9, 2025

Deploy Preview for composite-schemas ready!

Name Link
🔨 Latest commit 686fe3a
🔍 Latest deploy log https://app.netlify.com/projects/composite-schemas/deploys/68260db3470aac00084211da
😎 Deploy Preview https://deploy-preview-185--composite-schemas.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`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

Comment on lines +6455 to +6457
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
Copy link
Contributor

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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{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
Copy link
Contributor

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.

michaelstaib and others added 3 commits April 10, 2025 17:16
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Schema Products
# Schema Products

name: String
}

### Schema Categories
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Schema Categories
# Schema Categories

for that entity.

```graphql
# Schema: Order
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Schema: Order
# Schema Order

name: String
}

# Schema: User
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Schema: User
# Schema User

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants