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
1 change: 1 addition & 0 deletions .vale/styles/FernStyles/Headings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ exceptions:
- WebSocket
- WebSocket Playground
- OpenRPC
- GraphQL
- gRPC
- RPC
- SDK
Expand Down
3 changes: 3 additions & 0 deletions fern/products/docs/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ navigation:
- page: Generate OpenRPC reference
path: ./pages/api-references/generate-openrpc-ref.mdx
slug: generate-openrpc-ref
- page: Generate GraphQL reference
path: ./pages/api-references/generate-graphql-ref.mdx
slug: generate-graphql-ref
- section: SEO & GEO
slug: seo
collapsed: true
Expand Down
74 changes: 74 additions & 0 deletions fern/products/docs/pages/api-references/generate-graphql-ref.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: Generate GraphQL reference
description: Learn how to generate and customize GraphQL API Reference documentation
---

Fern generates API Reference documentation from a [GraphQL schema](https://graphql.org/learn/schema/). Add your schema file to your Fern project and Fern renders queries, mutations, subscriptions, and types as an interactive reference.

## How to add a GraphQL endpoint

1. Add your GraphQL schema files to your `/fern` directory.
2. Configure your `generators.yml` to point to your GraphQL schemas:

<CodeBlock title='generators.yml'>
```yaml
api:
specs:
- graphql: plants.schema.graphql
resource: Plants
origin: https://api.example.com/plants/graphql
- graphql: storefront.schema.graphql
resource: Storefront
origin: https://api.example.com/storefront/graphql
```
</CodeBlock>

3. Reference the API in your `docs.yml` navigation:

```yaml docs.yml
navigation:
- api: API Reference
```

### 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.
</ParamField>

<ParamField path="api.specs[].resource">
Name of the folder that operations from this spec appear under in the API Reference sidebar. Use this to group related GraphQL operations together.
</ParamField>

<ParamField path="api.specs[].origin">
URL of your GraphQL API endpoint. Fern performs [introspection](https://graphql.org/learn/introspection/) against this endpoint to fetch the schema. When set, [running `fern api update`](/learn/cli-api-reference/cli-reference/commands#fern-api-update) updates the local schema from this endpoint.
</ParamField>

### Include more than one GraphQL reference

To include multiple GraphQL definitions in your documentation, use the `api-name` property:

```yaml title="docs.yml"
navigation:
- api: Plant GraphQL API
api-name: plant-graphql
- api: Garden GraphQL API
api-name: garden-graphql
```

Organize each schema in a separate directory within your Fern project:

<Files>
<Folder name="fern" defaultOpen>
<Folder name="apis" defaultOpen>
<Folder name="plant-graphql" defaultOpen highlighted comment="Plant GraphQL schema">
<File name="schema.graphql" />
<File name="generators.yml" />
</Folder>
<Folder name="garden-graphql" defaultOpen highlighted comment="Garden GraphQL schema">
<File name="schema.graphql" />
<File name="generators.yml" />
</Folder>
</Folder>
</Folder>
</Files>
15 changes: 15 additions & 0 deletions fern/products/docs/pages/changelog/2026-02-09.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
tags: ["api-references", "configuration", "generators.yml"]
---

## GraphQL API Reference

Generate API Reference documentation from a GraphQL schema. Add your `.graphql` schema file to `generators.yml` and Fern renders queries, mutations, subscriptions, and types as an interactive reference.

```yaml generators.yml
api:
specs:
- graphql: schema.graphql
```

Learn more about [generating a GraphQL reference](/learn/docs/api-references/generate-graphql-ref).
Loading