Adding custom code
Fern-generated SDKs are designed to be extended with custom logic, methods, and dependencies. If you want your SDK to do more than just make basic API calls (like combining multiple calls, processing data, adding utilities), you can add custom code that lives in harmony with the generated code.
You can also add custom methods by inheriting the Fern generated client and extending it, plus add any dependencies that your custom methods depend on in your generators.yml
file.
Using .fernignore
to preserve your customizations
Once you add files containing custom code, use .fernignore
to protect your custom code from being overwritten when Fern regenerates your SDK.
Simply add your custom files to the SDK repository and list them in .fernignore
. Fern won’t override any files listed there. A .fernignore
file is automatically created in your SDK repository when you use GitHub publishing.
Your .fernignore
file might look something like this:
.fernignore
file for their TypeScript SDK.You’ll have a separate .fernignore
file for each of your SDKs:
Augmenting your SDK with custom code
Get started adding custom code to a specific SDK: