API Registry
Register OpenAPI specs and control where their pages appear.
The API registry tells Mordoc which OpenAPI specs to turn into API pages.
Create the registry file
The registry lives here:
config/api.yamlCreate it only when your project has an API reference. Without it, Mordoc skips all API features.
Register a spec
The simplest file is a list of specs:
- id: rings
spec: rings.yamlEach entry accepts these fields:
| Field | Required | What it does |
|---|---|---|
id | Yes | A short name for the API. Letters, digits, hyphens, and underscores only. It must be unique. It names the enrichment and example folders and is the default URL prefix. |
spec | Yes | The file name of the spec inside api/specs/. |
routePrefix | No | The URL prefix for this API's pages. Defaults to /api/<id>. |
Change where pages appear
By default, an operation page lives at /api/<id>/<operation-slug>. Use routePrefix to change it:
- id: rings
spec: rings.yaml
routePrefix: /referenceNow forgeRing opens at /reference/forge-ring.
routePrefix | URL of forgeRing |
|---|---|
| not set | /api/rings/forge-ring |
/reference | /reference/forge-ring |
/ | /forge-ring |
Use / for a site that is only an API reference.
Register more than one spec
Add an entry for each spec. Every id must be different:
- id: fellowship
spec: fellowship.yaml
- id: rings
spec: rings.yamlFail the build on any warning
To use the longer file shape, move the list under specs and add strict:
strict: true
specs:
- id: rings
spec: rings.yamlWith strict: true, every API warning fails the build. That includes the warning for undocumented fields, so any field without a description fails a strict build. Use it only if you want that rule. See Warnings and Errors.
Common mistakes
The build stops with a message that starts with config/api.yaml when:
- An entry has no
idor nospec. - An
idhas characters other than letters, digits, hyphens, and underscores. - Two entries share an
id. - The file lists no specs.
- A
specfile is missing fromapi/specs/.