Skip to content
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

Add validation for duplicate lookups. #170

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions spec/Section 2 -- Source Schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@ type Product @key(fields: "id") {
}
```

For a given source schema, there must be exactly one non-deprecated lookup field
that can resolve a given entity by a specific key. If multiple non-deprecated
lookup fields are defined that resolve the same entity by the same key, the
composition process must throw a composition error.

```graphql counter-example
type Query {
product(id: ID!): Product @lookup
productV2(id: ID!): Product @lookup
}

type Product @key(fields: "id") {
id: ID!
sku: String!
}
```

Lookups can also be nested within other lookups and allow resolving nested
entities that are part of an aggregate. In the following example the `Product`
can be resolved by its ID but also the `ProductPrice` can be resolved by passing
Expand Down