Overview of OpenAPI extensions

Fern supports a variety of OpenAPI extensions that enhance your API specification and generate higher-quality SDKs. You can apply these extensions in two ways: by overlaying them in separate override files or by embedding them directly in your OpenAPI specification.

Available extensions

The table below shows all available extensions and links to detailed documentation for each one.

ExtensionDescription
x-fern-versionConfigure API version schemes and headers
x-fern-audiencesFilter endpoints, schemas, and properties by audience
x-fern-availabilityMark availability status (beta, generally-available, deprecated)
x-fern-base-pathSet base path prepended to all endpoints
x-fern-enumAdd descriptions and custom names to enum values
x-fern-examplesAssociate request and response examples
x-fern-global-headersConfigure headers used across all endpoints
x-fern-ignoreSkip reading specific endpoints or schemas
x-fern-sdk-method-nameCustomize SDK method names
x-fern-sdk-group-nameOrganize methods into SDK groups
x-fern-parameter-nameCustomize parameter variable names
x-fern-property-nameCustomize object property variable names
x-fern-type-nameOverride auto-generated names for inline schemas
x-fern-server-nameName your servers
Request a new extension

If there’s an extension you want that doesn’t already exist, file an issue to start a discussion about it.

Overlaying extensions

Overlaying extensions allows you to keep your original API specification clean while adding Fern-specific customizations in a separate file. This approach is ideal when you’re using multiple tools that consume your API spec, or when you want to maintain a pristine source specification.

To use overlays, specify an overrides file in your generators.yml configuration.

The example below shows how to overlay SDK naming extensions. The first tab shows the generators.yml configuration that references an overrides file, the second tab contains the overrides file with Fern extensions, and the third tab shows the final result when the extensions are applied to your original API specification.

1api:
2 path: ./spec-folder/spec-file.yaml
3 overrides: ./spec-folder/overrides.yaml # Reference your overrides file
4default-group: sdk
5groups:
6 sdk:
7 generators:
8 - name: fernapi/fern-python-sdk
9 version: 2.2.0

Embedding extensions

Instead of using overlay files, you can embed Fern extensions directly within your API specification or source code. This approach is useful when you want to keep extensions close to your API definitions or when using frameworks that support custom extensions.

Direct embedding

You can add Fern extensions directly to your API specification:

spec-file.yml
1paths:
2 /users:
3 get:
4 x-fern-sdk-group-name: users
5 x-fern-sdk-method-name: listUsers
6 x-fern-availability: generally-available
7 summary: Get a list of users
8 responses:
9 '200':
10 description: Successful response

FastAPI

FastAPI allows you to add extensions directly in your route decorators and models. See our FastAPI integration guide for detailed examples.