Skip to content

Update documentation for @typePolicy #64

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

Merged
merged 1 commit into from
May 30, 2025
Merged
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
37 changes: 36 additions & 1 deletion kotlin_labs/v0.5/kotlin_labs-v0.5.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,42 @@ Since: 3.0.0
"""
directive @typePolicy(
"""
a selection set containing fields used to compute the cache key of an object. Order is important.
A selection set containing fields used to compute the cache key of an object.
Nested selection sets are currently not supported. Order is important.

Key fields can be defined on interfaces. In that case, the key fields apply to all sub-types and sub-types are not allowed to define their own key fields.
If a type implements multiple interfaces with keyfields, the keyfields must match across all interfaces with keyfields.

The key fields are automatically added to the operations by the compiler.
Aliased key fields are not recognized and the compiler adds a non-aliased version of the field if that happens.
If a type is queried through an interface/union, this may add fragments.

For an example, this query:

```graphql
query {
product {
price
}
}
```

is turned into this one after compilation:

```graphql
query {
product {
... on Book {
isbn
}
... on Movie {
id
}
price
}
}
```

"""
keyFields: String! = "",
"""
Expand Down