Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<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.
</Warning>

### Configuration properties

<ParamField path="api.specs[].graphql" required>
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.
</ParamField>

<ParamField path="api.specs[].name">
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.
</ParamField>

<ParamField path="api.specs[].origin">
Expand Down
8 changes: 8 additions & 0 deletions fern/products/docs/pages/changelog/2026-08-27.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## GraphQL schemas split across multiple files

<ChangelogTags>api-reference, generators.yml</ChangelogTags>

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.

<Button intent="none" outlined rightIcon="arrow-right" href="/learn/docs/api-references/generate-graphql-ref#compile-a-schema-split-across-multiple-files">Read the docs</Button>

## Blog layouts for changelogs

<ChangelogTags>navigation, customization</ChangelogTags>
Expand Down
Loading