Overlay customizations on an existing OpenAPI spec

Can’t directly modify your OpenAPI spec? No worries, use an overrides file instead.

If you generate your OpenAPI from server code, you may want to tweak your OpenAPI Spec without having to touch the generated file. Fern supports this via an overrides file.

1paths:
2 /users:
3 post:
4 description: Create a User
5 operationId: users_post
6 requestBody:
7 content:
8 application/json:
9 schema:
10 $ref: '#/components/schemas/User'

Configuration

Follow the steps below to configure your OpenAPI overrides:

1

Create an overrides.yml

Simply create a yaml file and write down all the overrides you want to add:

overrides.yml
1paths:
2 /v1/history:
3 get:
4 x-fern-sdk-group-name:
5 - history
6 x-fern-sdk-method-name: get_all
2

Reference the file in your generators.yml

generators.yml
1api:
2 path: ../openapi.yml
3 overrides: ../overrides.yml
The format of the overrides file is independent from the spec. For example, even if your OpenAPI spec is in JSON format, you can write the overrides in yaml.