diff --git a/fern/products/docs/pages/api-references/generate-graphql-ref.mdx b/fern/products/docs/pages/api-references/generate-graphql-ref.mdx index ae5fb5a17a..1c1fa533fa 100644 --- a/fern/products/docs/pages/api-references/generate-graphql-ref.mdx +++ b/fern/products/docs/pages/api-references/generate-graphql-ref.mdx @@ -73,14 +73,35 @@ navigation: api-name: garden-graphql ``` +### Compile a schema split across multiple files + +A schema split across several SDL files, the typical shape for [Apollo Federation](https://www.apollographql.com/docs/federation/) subgraphs, compiles into a single schema. List each file as its own spec and give the specs the same `name`: + +```yaml generators.yml +api: + specs: + - graphql: plants.graphql + name: Plants + - graphql: gardens.graphql + name: Plants +``` + +Specs that share a `name`, or that omit `name`, are parsed together, so a file can reference types defined in a sibling file and each file can `extend type Query` or `extend type Mutation`. Specs with different `name` values, and specs in different API workspaces, remain independent. + +The reference shows the client-facing schema: federation directives are stripped and `@inaccessible` types and members are omitted. If two files declare the same member differently, the first declaration wins and Fern logs a warning. + + + Specs sharing a namespace previously resolved collisions last-wins, without a warning. To keep the previous output, reorder the specs or give them distinct `name` values. + + ### Configuration properties - Path to your GraphQL schema file. You can include multiple GraphQL specs if your project exposes more than one GraphQL API. + Path to your GraphQL schema file. Include multiple GraphQL specs if your project exposes more than one GraphQL API, or if one schema is split across files. - Name of the folder that operations from this spec appear under in the API Reference sidebar. Use this to group related GraphQL operations together. + Name of the folder that operations from this spec appear under in the API Reference sidebar. Use this to group related GraphQL operations together. Specs that share a `name` are compiled into one schema. diff --git a/fern/products/docs/pages/changelog/2026-08-27.mdx b/fern/products/docs/pages/changelog/2026-08-27.mdx index 0da5315e05..28a80cdbc1 100644 --- a/fern/products/docs/pages/changelog/2026-08-27.mdx +++ b/fern/products/docs/pages/changelog/2026-08-27.mdx @@ -1,3 +1,11 @@ +## GraphQL schemas split across multiple files + +api-reference, generators.yml + +You can now generate a single GraphQL API Reference from a schema split across several SDL files, including Apollo Federation subgraphs. List each file as its own spec in `generators.yml` with the same `name`, and Fern compiles them into one schema. + + + ## Blog layouts for changelogs navigation, customization