diff --git a/docs/graphql-api/apollo-federation.mdx b/docs/graphql-api/apollo-federation.mdx index 4819c0419..6c5dcc895 100644 --- a/docs/graphql-api/apollo-federation.mdx +++ b/docs/graphql-api/apollo-federation.mdx @@ -16,7 +16,8 @@ seoFrontMatterUpdated: true --- ## Introduction -Hasura DDN itself can be used as a subgraph in an supergraph created by + +Hasura DDN itself can be used as a subgraph in a supergraph created by [Apollo Federation](https://www.apollographql.com/docs/federation/). Apollo Federation is a way to compose multiple GraphQL services (called subgraphs) into a unified API (called a @@ -24,11 +25,11 @@ supergraph). :::info Supergraphs and Subgraph terminology in Hasura DDN and Apollo Federation -Some of the naming used in Apollo Federation conflicts with the same names used in Hasura. Here is a quick glossary -to help you understand the terms better: +Some of the naming used in Apollo Federation conflicts with the same names used in Hasura. Here is a quick glossary to +help you understand the terms better: | Term | Hasura | Apollo Federation | -|------------|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| +| ---------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | | Subgraph | A subgraph in Hasura is the notion of a module of Hasura supergraph metadata. | A subgraph in Apollo Federation is a **standalone GraphQL service.** | | Supergraph | A supergraph in Hasura is the collection of subgraph metadata and the resultant GraphQL API that is created. | A supergraph in Apollo Federation is a unified GraphQL API that is created by stitching multiple subgraph APIs. | @@ -40,7 +41,6 @@ Hasura DDN is compliant with the [Apollo Federation subgraph specification](https://www.apollographql.com/docs/federation/subgraph-spec/), so you can plug Hasura DDN in as a subgraph in your Apollo federated supergraph. - ```mermaid graph LR; clients(Clients); @@ -81,11 +81,11 @@ definition: ## Marking a Type as an Apollo Entity Types defined in Hasura DDN can also be marked as -[Apollo Entities](https://www.apollographql.com/docs/federation/entities/). This will allow the same type to be -resolved from DDN (and your other subgraphs that defines the type) as well. +[Apollo Entities](https://www.apollographql.com/docs/federation/entities/). This will allow the same type to be resolved +from DDN (and your other subgraphs that defines the type) as well. -To mark a type as an entity, you will have to edit the metadata for the `ObjectType` and the `Model` which will be -used to resolve the type. +To mark a type as an entity, you will have to edit the metadata for the `ObjectType` and the `Model` which will be used +to resolve the type. 1. Add the keys for the `ObjectType`. The [keys](https://www.apollographql.com/docs/federation/entities/#1-define-a-key) can be defined as following in the @@ -95,7 +95,7 @@ used to resolve the type. apolloFederation: keys: # The fields that uniquely identifies the entity - fields: - - id + - id ``` 2. Mark the `Model` that should act as the source for the entity. This can be done by adding the following in the