Custom code regions
Availability
Custom code regions are only available for Enterprise users.
Custom code regions must be enabled in settings/billing
under the account.
Generally, the Speakeasy code generator “owns” the files it generates. If
modifications are made to them, then the next code generation run will overwrite
all edits. One way to persist modifications to generated files is
to add them to .genignore
, but this has a significant drawback: those files
will stop receiving updates during generation, and thus risk build failures in
the future.
Custom code regions allow 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 files while providing a constrained way to add bespoke functionality to SDKs.
Syntax
Custom code regions are defined by adding a start and end comments to prescribed
sections of a generated file. The comments follow Visual Studio Code’s format
for creating code folds
Language support
Custom code regions are currently supported in the following languages:
Last updated on