From dc499ebc131259d085bc78a4031ff7b395a0bc9e Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Thu, 11 Apr 2024 13:13:14 +0200 Subject: [PATCH] edits --- spec/Section 2 -- Source Schema.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/spec/Section 2 -- Source Schema.md b/spec/Section 2 -- Source Schema.md index efef681..41b4840 100644 --- a/spec/Section 2 -- Source Schema.md +++ b/spec/Section 2 -- Source Schema.md @@ -8,9 +8,7 @@ directive @lookup on FIELD_DEFINITION ``` -Entity resolvers are fields on the query root type of a subgraph that can -resolve an entity by a stable key. The stable key is defined by the arguments of -the field. +Lookup fields allow the composite schema to resolve entities from a source schema by a stable key. The stable key is defined by the arguments of the field. Only fields that are annotated with the `@lookup` directive will be recognized as lookup field. ```graphql example extend type Query { @@ -18,26 +16,24 @@ extend type Query { personById(id: ID!): Person @lookup } -extend type Person { - id: ID! # matches the argument of personById +extend type Person @key(fields "id") { + id: ID! } ``` -The arguments of an entity resolver field must match fields of the returning -type. +The arguments of a lookup field must match fields specified with a `@key` directive annotated on the return type for the lookup field. ```graphql example extend type Query { node(id: ID!): Node @lookup } -interface Node { +interface Node @key(fields "id") { id: ID! } ``` -When an entity resolver returns an interface all implementing types are inferred -as entities. +Lookup fields returning an interface type can be used as lookup field for all implementing object types. ```graphql example extend type Query {