OpenAPI generators.yml reference

View as Markdown

The generators.yml file serves two roles: it declares your OpenAPI specification location (in the api.specs section), and configures SDK generation (in the optional groups section).

APIs declared here can be rendered in your documentation via docs.yml. See Generate your API Reference.

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 for this individual spec. To apply the same settings across all OpenAPI specs, use global api.settings instead.

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

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

settings.inline-path-parameters
booleanDefaults to true

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 true

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

settings.object-query-parameters
booleanDefaults to true

Enables parsing deep object query parameters.

settings.wrap-references-to-nullable-in-optional
booleanDefaults to false

Controls whether references to nullable schemas are wrapped in optional types. When false, nullable references are treated as required fields that can be null.

settings.coerce-optional-schemas-to-nullable
booleanDefaults to false

Controls whether optional schemas are coerced to nullable types during code generation. When false, optional and nullable are treated as distinct concepts.

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 false

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 false

Controls whether enums are converted to literal types during code generation. When false (default), enums are preserved as enum types, maintaining the original enum structure from your OpenAPI specification. When true, enums are coerced to literal types, which can be useful for simpler type representations in generated code.

settings.idiomatic-request-names
booleanDefaults to true

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.

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.