Augment with custom code
The Fern generated SDKs are designed to be extended with custom code. Your custom code can be used to add additional functionality to the SDK and will live in harmony with the generated code.
Custom logic
If you want to provide any logic in your SDK that goes beyond hitting the REST API, you can
do so by leveraging .fernignore
.
Simply add your custom files to the SDK repository and list them out in .fernignore
. Fern
won’t override any files that you add in .fernignore
.
TypeScript
Python
Java
Go
Custom SDK methods
Fern also allows you to add custom methods to the SDK itself (e.g. client.my_method()
).
While the specifics are slightly different for each language, the underlying principle is the same: extension. You can inherit the Fern generated client and add whatever methods you want.
TypeScript
Python
Java
Go
See an example from Flatfile using this process in their TypeScript SDK
Create a new file src/wrapper/MyClient.ts
You can import the Fern generated client from ../client
and alias it to FernClient
.
Next, extend FernClient
and add whatever methods you want.
Custom dependencies
To add custom dependencies to your generated SDKs, you can update your generators.yml
.