OpenAPI generators.yml reference

Configure how your OpenAPI specification is processed and transformed into SDKs using the generators.yml configuration file.

generators.yml
1api:
2 specs:
3 - openapi: "./openapi.yml"
4 origin: "https://api.example.com/openapi.json"
5 overrides: "./openapi-overrides.yml"
6 namespace: "v1"
7 settings:
8 title-as-schema-name: true
9 inline-path-parameters: false
10 inline-all-of-schemas: true
11 prefer-undiscriminated-unions-with-literals: true
12 filter:
13 endpoints: ["POST /users", "GET /users/{id}"]
14 example-generation:
15 request:
16 max-depth: 2
openapi
stringRequired

Path to the OpenAPI specification file.

origin
string

URL of the API definition origin for pulling updates. For instructions on how to set up automatic syncing, refer to Sync your OpenAPI specification.

overrides
string

Path to OpenAPI overrides file.

namespace
string

Namespace for the specification. Useful for configuring a single package with multiple API versions.

settings
object

OpenAPI-specific generation settings.

settings.title-as-schema-name
booleanDefaults to true

Whether to use the titles of schemas within an OpenAPI definition as the names of types within Fern.

settings.inline-path-parameters
booleanDefaults to false

Whether to include path parameters within the generated in-lined request.

settings.inline-all-of-schemas
booleanDefaults to false

Whether to inline allOf schemas during code generation. When true, Fern recursively visits allOf schema definitions and inlines them into the child schema. When false, allOf schemas are extended through inheritance.

Enabling this setting allows child schemas to override parent property requirements. For example, a child schema can mark a parent’s required property as optional. Without this setting, Fern ignores the child schema’s optional declaration and preserves the parent schema’s requirement instead.

settings.prefer-undiscriminated-unions-with-literals
booleanDefaults to false

Whether to prefer undiscriminated unions with literals.

settings.only-include-referenced-schemas
booleanDefaults to false

Whether to only include schemas referenced by endpoints in the generated SDK (tree-shaking).

settings.respect-nullable-schemas
booleanDefaults to false

Preserves nullable schemas in API definition settings. When false, nullable schemas are treated as optional.

settings.object-query-parameters
boolean

Enables parsing deep object query parameters.

settings.respect-readonly-schemas
boolean

Enables exploring readonly schemas in OpenAPI specifications.

settings.respect-forward-compatible-enums
booleanDefaults to false

Enables respecting forward compatible enums in OpenAPI specifications.

settings.use-bytes-for-binary-response
boolean

Enables using the bytes type for binary responses. Defaults to file stream.

settings.default-form-parameter-encoding
stringDefaults to json

The default encoding of form parameters. Options: form, json.

settings.additional-properties-defaults-to
booleanDefaults to false

Configure what additionalProperties should default to when not explicitly defined on a schema.

settings.type-dates-as-strings
booleanDefaults to true

If true, convert strings with format date to strings. If false, convert to dates.

settings.preserve-single-schema-oneof
booleanDefaults to false

If true, preserve oneOf structures with a single schema. If false, unwrap them.

settings.filter.endpoints
list of strings

Endpoints to include in the generated SDK (e.g., “POST /users”).

settings.example-generation.request.max-depth
integer

Controls the maximum depth for which optional properties will have examples generated. A depth of 0 means no optional properties will have examples.

settings.example-generation.response.max-depth
integer

Controls the maximum depth for which optional properties will have examples generated in responses.

settings.coerce-enums-to-literals
booleanDefaults to true

Controls whether enums are converted to literal types during code generation. When set to false, enums are preserved as enums rather than being converted to literal types. This is useful when you want to maintain the original enum structure from your OpenAPI specification.

settings.idiomatic-request-names
booleanDefaults to false

Controls the naming convention for autogenerated request names. When enabled, places the verb before the noun in request names (e.g., UsersListRequest becomes ListUsersRequest), following more idiomatic naming patterns.

Disabled by default to maintain backwards compatibility.

settings.resolve-aliases
booleanDefaults to false

Inlines type aliases to simplify your generated SDK. When enabled, reduces unnecessary type definitions by replacing simple aliases with their underlying types directly. Useful for OpenAPI specs with many primitive or simple type aliases.

Set to true to inline all aliases, or use an object with an except array to preserve specific type aliases:

1settings:
2 # Inline all aliases
3 resolve-aliases: true
4
5 # Or preserve specific aliases
6 resolve-aliases:
7 except:
8 - UserId
9 - OrganizationId
settings.group-environments-by-host
booleanDefaults to false

When enabled, groups servers by host into unified environments, enabling APIs with multiple protocols (REST, WebSocket, etc.) to share environment configuration. Environment URL IDs use the server name, with path or protocol suffixes added only when needed to resolve collisions.