Custom code regions

Info Icon

Availability

Custom code regions are only available for Enterprise users. Enable Custom code regions in Settings > Billing under your account.

The Speakeasy code generator typically “owns” the files it generates. If generated files are modified, edits will be overwritten in the next code generation run. You can persist modifications to generated files by adding them to .genignore, but this approach has a significant drawback: Files added to .genignore will not be updated during generation, which may lead to future build failures.

The custom code regions feature allows developers to add code to specific sections of a generated file that the generator knows to carry forward. Speakeasy can continue to own and update the files while offering a controlled way to add custom functionality to SDKs.

Syntax

Custom code regions are defined by adding start and end comments to prescribed sections of a generated file. The comments follow Visual Studio Code’s format for creating code folds (opens in a new tab).

Language support

Custom code regions are currently supported in the following languages: