Overrides
Use an overrides file to customize your OpenAPI, AsyncAPI, or OpenRPC definition without modifying the original spec. This is useful when:
- Your API specification is auto-generated from server code
- You need different configurations for SDKs versus documentation
Overrides are available for OpenAPI, AsyncAPI, and OpenRPC specifications. They’re not needed for Fern Definition since you can directly edit those files.
For OpenAPI specs, Fern recommends using overlays instead of overrides. Overlays follow the official OpenAPI Overlay Specification, support bulk changes with JSONPath wildcards, and are portable across the OpenAPI ecosystem.
Overrides are also fully supported. If overrides are working for your team, there’s no need to switch. You can also use both together (overrides are applied first, then overlays).
Implement overrides
Create an overrides file
Create an overrides.yml file in the folder that contains your API definition:
Customize your spec with Fern extensions
For OpenAPI, AsyncAPI, and OpenRPC, you can use Fern’s extensions to apply customizations.
Managing overrides across APIs
The overrides field accepts a single path or a list of paths. When multiple paths are provided, overrides are applied sequentially in order, with later files taking precedence over earlier ones for conflicting keys.
Separate overrides for SDKs and docs
When you need entirely different overrides for SDK generation versus documentation, use separate folders with their own generators.yml. Each folder references only the overrides relevant to its concern:
If the SDK and docs overrides share a common base, you can use multiple override files within each folder to avoid duplication:
Overrides for different environments
When your public and internal APIs share the same spec but need different overrides, use multiple override files to layer internal-specific additions on top of the public base. This is especially useful when the internal API is a superset of the public API:
This avoids duplicating the public overrides in the internal configuration. The internal-overrides.yml file only needs to contain the additions specific to the internal API.