OpenAPI Specification

How to use OpenAPI Overrides

Use overrides to customize user-facing documentation fields, examples, and naming.

When you generate your OpenAPI from server code, you may want to further customize portions of your OpenAPI spec. You can do this with OpenAPI Overrides. When you run fern generate, Fern will automatically apply these overrides on top of your OpenAPI spec.

How to use OpenAPI Overrides

To use OpenAPI Overrides, create a file named openapi-overrides.yml. You can put the file anywhere in your project. This file contains the overrides you want to apply to your OpenAPI spec. For more on the extensions available, visit our page on OpenAPI Extensions.

Example

Here’s an example of an openapi-overrides.yml file for the ElevenLabs API:

openapi-overrides.yml
1x-fern-global-headers:
2 - header: xi-api-key
3 name: api-key
4 optional: true
5 env: ELEVEN_API_KEY
6servers:
7 - url: https://api.elevenlabs.io/
8 x-fern-server-name: Production
9x-fern-groups:
10 samples:
11 summary: Samples
12 voices:
13 summary: Voices
14 projects:
15 summary: Projects
16 models:
17 summary: Models
18paths:
19 /v1/history:
20 get:
21 x-fern-sdk-group-name:
22 - history
23 x-fern-sdk-method-name: get_all
24 x-fern-examples:
25 - query-parameters:
26 page_size: 1
27 voice_id: "pMsXgVXv3BLzUgSXRplE"
28 response:
29 body:
30 history:
31 [
32 {
33 history_item_id: "ja9xsmfGhxYcymxGcOGB",
34 request_id: "BF0BZg4IwLGBlaVjv9Im",
35 settings:
36 {
37 similarity_boost: 0.5,
38 stability: 0.71,
39 style: 0,
40 use_speaker_boost: true,
41 },
42 source: "TTS",
43 },
44 ]
45 last_history_item_id: "ja9xsmfGhxYcymxGcOGB"
46 has_more: true
47 /v1/history/{history_item_id}:
48 get:
49 x-fern-sdk-group-name:
50 - history
51 x-fern-sdk-method-name: get

Specifying OpenAPI Overrides in generators.yml

You’ll need to specify the path to your openapi-overrides.yml file in your generators.yml file. Here’s an example:

../openapi-overrides.yml
1api:
2 - path: ../openapi.json
3 overrides: ../openapi-overrides.yml