You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -30,10 +29,9 @@ This directive MUST be used on a field with a non-nullable scalar type. Other ty
30
29
31
30
The directive can have a parameter indicating the scope of the identity. They are ordered from _narrowest_ to _widest_:
32
31
33
-
1.`SELECTION`: The identifier is only unique within the current list. Identifiers may be reused between different objects with the same typename.
34
-
2.`TYPE`: The identifier is unique for the type, e.g. an auto-incrementing column from a database table.
35
-
3.`SERVICE`: The identifier is unique across the current GraphQL Service.
36
-
4.`GLOBAL`: The identifier is unique across all GraphQL services. This can be used by identifiers generated according to [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122) or [RFC 9562](https://datatracker.ietf.org/doc/html/rfc9562) (also known as Universally Unique IDentifiers or UUIDs).
32
+
1.`TYPE`: The identifier is unique for the type, e.g. an auto-incrementing column from a database table.
33
+
2.`SERVICE`: The identifier is unique across the current GraphQL Service.
34
+
3.`GLOBAL`: The identifier is unique across all GraphQL services. This can be used by identifiers generated according to [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122) or [RFC 9562](https://datatracker.ietf.org/doc/html/rfc9562) (also known as Universally Unique IDentifiers or UUIDs).
37
35
38
36
## Usage in types
39
37
@@ -73,7 +71,7 @@ query GetAllAnimals {
73
71
}
74
72
```
75
73
76
-
It is allowed for a query and a type to both use the directive to describe the same field. If the schema and client define different scopes for the same field, the widest option is used. This allows client authors to widen the scope if required.
74
+
It is allowed for a query and a type to both use the directive to describe the same field. If the client and schema use different scopes for the same field, the scope defined by the schema is used. Clients SHOULD NOT define a wider scope than declared by the schema. Codegen should emit a warning in this case.
77
75
78
76
If the server defines a field as an identity, a query SHOULD NOT choose another field. A query MUST NOT use the directive on more than one field in the same selection (unless they are in differently nested objects).
79
77
@@ -103,7 +101,7 @@ In this case, a conformance to Identifiable SHOULD NOT be generated. Codegen sho
103
101
104
102
## Caching behavior
105
103
106
-
A scope of `SELECTION` does not allow the identifier to be used as a caching key. Clients MAY use other mechanisms to determine if and how to cache the object.
104
+
If no `@identity` directive is present, clients MAY use other mechanisms to determine if and how to cache the object.
107
105
108
106
An identifier with scope `TYPE` can be combined with the `__typename` field to generate a caching key that's unique for the GraphQL Service.
109
107
@@ -117,7 +115,7 @@ The code generator could be updated to always emit a conformance to Identifiable
117
115
118
116
## Apollo Kotlin's @typePolicy directive
119
117
120
-
Apollo Kotlin has [custom directives](https://www.apollographql.com/docs/kotlin/caching/declarative-ids) that allows for client authors to specify the caching key though pure GraphQL:
118
+
Apollo Kotlin has [custom directives](https://www.apollographql.com/docs/kotlin/caching/declarative-ids) that allows for client authors to specify the caching key through pure GraphQL:
0 commit comments