Speakeasy Logo
Skip to Content

The gen.yaml file reference

The gen.yaml file has several sections:

  • The generation section is essential for SDK configuration
  • The management and features sections are maintained by Speakeasy and should not be edited
  • The final section is for language-specific configuration (for more information, see the language-specific configuration docs)

Generation

configVersion

The currently supported version of the Speakeasy gen.yaml configuration file is 2.0.0. Older versions will be automatically upgraded when encountered.

configVersion: 2.0.0

generation

The generation section of the gen.yaml file supports configuration that is relevant to all SDK targets. If a value isn’t configured here, and it has a default value, then that value will be added automatically on the next generation. For more information about SDK generation and targets, see our core concepts documentation.

generation: sdkClassName: speakeasybar maintainOpenAPIOrder: true usageSnippets: optionalPropertyRendering: withExample devContainers: enabled: true schemaPath: "path/to/schema" useClassNamesForArrayFields: true fixes: nameResolutionDec2023: true parameterOrderingFeb2024: true requestResponseComponentNamesFeb2024: true securityFeb2025: true auth: OAuth2ClientCredentialsEnabled: true inferSSEOverload: true

sdkClassName

Defines the class name of the main imported class in the generated SDK.

sdkClassName: speakeasybar

maintainOpenAPIOrder

Determines whether the parameters, properties, operations, etc., are maintained in the same order they appear in the OpenAPI document. If set to false, these elements are sorted alphabetically.

maintainOpenAPIOrder: true

usageSnippets

The options for optionalPropertyRendering include always, never, and withExample, which renders optional properties only when an example is present in the OpenAPI document.

usageSnippets: optionalPropertyRendering: withExample

devContainers

Enables or disables the use of development containers, and specifies the schema path. For more information about development containers and SDK sandboxes, see our SDK sandbox documentation.

devContainers: enabled: true schemaPath: "path/to/schema"

useClassNamesForArrayFields

When set to true, array fields use class names instead of child schema types.

useClassNamesForArrayFields: true

fixes

Includes specific fixes or features to be applied during SDK generation to avoid breaking changes.

  • nameResolutionDec2023: Disabling not recommended. Enables changes introduced in December 2023 for improved name resolution, defaults to true for new SDKs. For older SDKs, setting true is recommended, but will be a breaking change.
  • parameterOrderingFeb2024: Disabling not recommended. Enables changes introduced in February 2024 to respect the order of parameters in the OpenAPI document where possible, defaults to true for new SDKs. For older SDKs, setting true is recommended, but will be a breaking change.
  • requestResponseComponentNamesFeb2024: Disabling not recommended. Enables changes introduced in February 2024 to use the name of parent request/response components where possible, defaults to true for new SDKs. For older SDKs, setting true is recommended, but will be a breaking change.
  • securityFeb2025: Disabling not recommended. Enables changes introduced in February 2025 to the security handling at both the global and operation level, particularly needed to enable per-operation OAuth2 flows. Defaults to true for new SDKs. For older SDKs, setting true is recommended, but will be a breaking change.
fixes: nameResolutionDec2023: true parameterOrderingFeb2024: true requestResponseComponentNamesFeb2024: true securityFeb2025: true

auth

  • OAuth2ClientCredentialsEnabled: Enables the generation of code for handling OAuth 2.0 client credentials for authentication, where possible. Business and Enterprise plans only.
  • hoistGlobalSecurity: When true (default), Speakeasy identifies the most commonly used operation-level security scheme and hoists it to global security if no global security is defined. Set to false to disable this behavior.

For detailed information about authentication configuration, see our guide to customizing security and authentication.

auth: OAuth2ClientCredentialsEnabled: true hoistGlobalSecurity: true

Disable security hoisting

Set hoistGlobalSecurity to false to opt out:

auth: hoistGlobalSecurity: false

inferSSEOverload

Enables the generation of method overloads for Python SDKs to provide better type safety for Server-Sent Events (SSE) operations. When set to true (default), Speakeasy will automatically create overloaded methods for operations that meet specific criteria:

  • The operation has a request body
  • The request body contains a stream field (boolean type)
  • The operation has exactly two responses: one text/event-stream and one application/json

This feature is currently Python-specific, with support for other languages planned for future releases.

inferSSEOverload: true

baseServerUrl

Used to declare the base server URL. It overrides the servers field in the OpenAPI document if present, or provides a server URL if the servers field is absent.

baseServerUrl: "speakeasy.bar/public/api/"

mockServer

Disables the generation and use of a mock HTTP server with generated tests.

mockServer: disabled: true

schemas

Configuration for how OpenAPI schemas are processed during SDK generation.

allOfMergeStrategy

Controls how allOf constructs in OpenAPI schemas are merged. For detailed information about merge strategies, see the allOf schemas documentation.

  • deepMerge (default for new SDKs): Recursively merges nested properties within objects, preserving properties from all schemas in the allOf array.
  • shallowMerge (legacy behavior): Replaces entire property blocks when merging, which can result in lost properties from earlier schemas.
schemas: allOfMergeStrategy: deepMerge

Last updated on