Custom code regions
New feature
Looking for more flexibility? Check out Custom code - a feature that allows custom changes anywhere in the SDK, not just in predefined regions.
Generally, the Speakeasy code generator “owns” the files it generates. Modifying these files causes the next generation run to 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 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:
Availability
Custom code regions are only available for Enterprise users.
Custom code regions must be enabled in settings/billing under the account.
Last updated on