From 909be130d547c0da8902b102c6f9509c6e81d579 Mon Sep 17 00:00:00 2001 From: Edward Huang Date: Tue, 11 Jun 2024 08:12:04 -0700 Subject: [PATCH] docs: context directives are enterprise features (#3025) Add Enterprise feature callouts for context directives Co-authored-by: Chris Lenfest --- docs/source/entities-advanced.mdx | 6 ++++++ docs/source/federated-types/federated-directives.mdx | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/docs/source/entities-advanced.mdx b/docs/source/entities-advanced.mdx index 9a59bfc4e..612818685 100644 --- a/docs/source/entities-advanced.mdx +++ b/docs/source/entities-advanced.mdx @@ -918,6 +918,12 @@ This problem is not limited to reference resolvers. In fact, it can occur with a + + +The `@context` and `@fromContext` directives are [Enterprise features](/router/enterprise-features) of the Apollo Router and require an organization with a [GraphOS Enterprise plan](https://www.apollographql.com/pricing/). If your organization doesn't have an Enterprise plan, you can test it out by signing up for a free [Enterprise trial](/graphos/org/plans/#enterprise-trials). + + + Use the `@context` and `@fromContext` directives to set and get a _context_ to share data between types in a subgraph. Contexts provide a way for a subgraph to share data between types of a nested-type hierarchy without overloading entity keys with extraneous fields. Contexts also preserve the separation of concerns between different subgraphs. In an entity, a nested object may have a dependency on an ancestor type and thus need access to that ancestor's field(s). diff --git a/docs/source/federated-types/federated-directives.mdx b/docs/source/federated-types/federated-directives.mdx index 59ba58dee..8f0812af1 100644 --- a/docs/source/federated-types/federated-directives.mdx +++ b/docs/source/federated-types/federated-directives.mdx @@ -924,6 +924,8 @@ If different subgraphs use different versions of a directive's corresponding spe + + The `@context` directive defines a named context from which a field of the annotated type can be passed to a receiver of the context. The receiver must be a field annotated with the `@fromContext` directive. ```graphql @@ -957,6 +959,8 @@ type U @key(fields: "id") { + + The `@fromContext` directive sets the context from which to receive the value of the annotated field. The context must have been defined with the `@context` directive. ```graphql