Skip to content

Commit 0c2c950

Browse files
committed
Merge in new custom code overview page and related link updates
2 parents 0107031 + db0ca92 commit 0c2c950

File tree

11 files changed

+98
-36
lines changed

11 files changed

+98
-36
lines changed

fern/products/sdks/capabilities.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ layout: overview
6161
<Card title="Code Snippets" icon="fa-duotone fa-brackets-curly">
6262
No longer depend on manually written code snippets
6363
</Card>
64-
<Card title="Augment with Custom Code" icon="fa-duotone fa-puzzle-piece" href="/sdks/generators/typescript/adding-custom-code">
64+
<Card title="Augment with Custom Code" icon="fa-duotone fa-puzzle-piece" href="/sdks/overview/custom-code">
6565
Extend the generated SDK to provide additional functionality
6666
<p className="text-(color:--grayscale-a11) font-bold mt-2 flex items-center gap-1">
6767
Learn more

fern/products/sdks/custom-code.mdx

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Adding custom code
3+
description: Augment your SDK with custom utilities
4+
---
5+
6+
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.
7+
8+
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.
9+
10+
## Using `.fernignore` to preserve your customizations
11+
12+
Once you add files containing custom code, use `.fernignore` to protect your custom code from being overwritten when Fern regenerates your SDK.
13+
14+
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.
15+
16+
Your `.fernignore` file might look something like this:
17+
18+
```gitignore title=".fernignore"
19+
# Documentation and licensing
20+
README.md
21+
LICENSE
22+
23+
# Custom workflows
24+
.github/workflows/test.yml
25+
.github/workflows/ci.yml
26+
27+
# Custom code
28+
src/CustomClient.ts
29+
```
30+
<Note>For another example, see Cohere's [`.fernignore` file for their TypeScript SDK](https://github.com/cohere-ai/cohere-typescript/blob/ad583e3003bd51e80a82317f9e16beec85881b86/.fernignore).</Note>
31+
32+
You'll have a separate `.fernignore` file for each of your SDKs:
33+
34+
```text {9, 13}
35+
├─ company-repo # Top-level repo for all SDKs
36+
├─ fern/
37+
├─ apis/
38+
├─ sdks/
39+
└── generators.yml # Contains settings for all SDKs
40+
├─ typescript-sdk-repo # Repository for a TypeScript SDK
41+
├─ .github/workflows/
42+
├─ src/
43+
└── .fernignore
44+
├─ python-sdk-repo
45+
├─ .github/workflows/
46+
├─ src/
47+
└── .fernignore
48+
```
49+
50+
51+
## Augmenting your SDK with custom code
52+
53+
Get started adding custom code to a specific SDK:
54+
55+
<CardGroup cols={3}>
56+
<Card title="TypeScript" icon={<img src="./images/icons/ts-light.svg" alt="TypeScript logo" className="h-6 w-6" noZoom />} href="/sdks/generators/typescript/custom-code">
57+
</Card>
58+
<Card title="Python" icon={<img src="./images/icons/python-light.svg" className="h-6 w-6" noZoom />} href="/sdks/generators/python/custom-code">
59+
</Card>
60+
<Card title="Go" icon={<img src="./images/icons/go-light.svg" className="h-6 w-6" noZoom />} href="/sdks/generators/go/custom-code">
61+
</Card>
62+
<Card title="Java" icon={<img src="./images/icons/java-light.svg" className="h-6 w-6" noZoom />} href="/sdks/generators/java/custom-code">
63+
</Card>
64+
<Card title=".NET" icon={<img src="./images/icons/csharp-light.svg" className="h-6 w-6" noZoom />}>
65+
Coming soon
66+
</Card>
67+
<Card title="PHP" icon={<img src="./images/icons/php-light.svg" className="h-6 w-6" noZoom />}>
68+
Coming soon
69+
</Card>
70+
<Card title="Ruby" icon={<img src="./images/icons/ruby-light.svg" className="h-6 w-6" noZoom />}>
71+
Coming soon
72+
</Card>
73+
</CardGroup>

fern/products/sdks/fern-folder.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Configuring Fern starts with the `fern` folder, the root directory that contains
77
your API definitions, generators, and your CLI version.
88

99
After you configure your `fern` folder, you'll be ready to start generating SDKs
10-
in different languages.
10+
in different languages and [augmenting them with custom code](/sdks/overview/custom-code).
1111

1212
## Set up the fern folder
1313

@@ -49,6 +49,10 @@ in different languages.
4949
</Card>
5050
</CardGroup>
5151

52+
### Augment your SDK with custom code
53+
54+
Learn more about [adding custom code and utilizing a `.fernignore` file](/sdks/overview/custom-code).
55+
5256
</Steps>
5357

5458
## Learn more about the initialized files

fern/products/sdks/overview/go/custom-code.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ title: Adding custom code
33
description: Augment your Go SDK with custom utilities
44
---
55

6-
<Markdown src="/products/sdks/snippets/custom-code-intro.mdx"/>
6+
This page covers how to add custom logic and methods to your Go SDK.
7+
8+
<Markdown src="/products/sdks/snippets/custom-code-callout.mdx"/>
79

810
## Adding custom logic
911

10-
<Markdown src="/products/sdks/snippets/custom-logic-intro.mdx"/>
12+
To get started adding custom code:
1113

1214
<Steps>
1315

@@ -21,9 +23,6 @@ description: Augment your Go SDK with custom utilities
2123

2224
### Add your file to `.fernignore`
2325

24-
<Tip>A `.fernignore` file is automatically created in your SDK repository when you use GitHub publishing.</Tip>
25-
26-
2726
```yaml {3} title=".fernignore"
2827
# Specify files that shouldn't be modified by Fern
2928

fern/products/sdks/overview/java/custom-code.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
title: Adding custom code
33
description: Augment your Java SDK with custom utilities
44
---
5+
This page covers how to add custom logic, methods, and dependencies to your TypeScript SDK.
56

6-
<Markdown src="/products/sdks/snippets/custom-code-intro.mdx"/>
7+
<Markdown src="/products/sdks/snippets/custom-code-callout.mdx"/>
78

89
## Adding custom logic
910

10-
<Markdown src="/products/sdks/snippets/custom-logic-intro.mdx"/>
11+
To get started adding custom code:
1112

1213
<Steps>
1314

@@ -27,9 +28,6 @@ description: Augment your Java SDK with custom utilities
2728

2829
### Add your file to `.fernignore`
2930

30-
<Tip>A `.fernignore` file is automatically created in your SDK repository when you use GitHub publishing.</Tip>
31-
32-
3331
```yaml {3} title=".fernignore"
3432
# Specify files that shouldn't be modified by Fern
3533

fern/products/sdks/overview/python/custom-code.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ title: Adding custom code
33
description: Augment your Python SDK with custom utilities
44
---
55

6-
<Markdown src="/products/sdks/snippets/custom-code-intro.mdx"/>
6+
This page covers how to add custom logic, methods, and dependencies to your Python SDK.
7+
8+
<Markdown src="/products/sdks/snippets/custom-code-callout.mdx"/>
79

810
## Adding custom logic
911

10-
<Markdown src="/products/sdks/snippets/custom-logic-intro.mdx"/>
12+
To get started adding custom code:
1113

1214
<Steps>
1315

@@ -21,9 +23,6 @@ description: Augment your Python SDK with custom utilities
2123

2224
### Add your file to `.fernignore`
2325

24-
<Tip>A `.fernignore` file is automatically created in your SDK repository when you use GitHub publishing.</Tip>
25-
26-
2726
```yaml {3} title=".fernignore"
2827
# Specify files that shouldn't be modified by Fern
2928

fern/products/sdks/overview/typescript/custom-code.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ title: Adding custom code
33
description: Augment your TypeScript SDK with custom utilities
44
---
55

6-
<Markdown src="/products/sdks/snippets/custom-code-intro.mdx"/>
6+
This page covers how to add custom logic, methods, and dependencies to your TypeScript SDK.
7+
8+
<Markdown src="/products/sdks/snippets/custom-code-callout.mdx"/>
79

810
## Adding custom logic
911

10-
<Markdown src="/products/sdks/snippets/custom-logic-intro.mdx"/>
12+
To get started adding custom code:
1113

1214
<Steps>
1315

@@ -21,9 +23,6 @@ description: Augment your TypeScript SDK with custom utilities
2123

2224
### Add your file to `.fernignore`
2325

24-
<Tip>A `.fernignore` file is automatically created in your SDK repository when you use GitHub publishing.</Tip>
25-
26-
2726
```yaml {3} title=".fernignore"
2827
# Specify files that shouldn't be modified by Fern
2928

fern/products/sdks/sdks.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ navigation:
77
- page: Quickstart
88
path: ./fern-folder.mdx
99
slug: quickstart
10+
- page: Adding Custom Code
11+
path: ./custom-code.mdx
12+
slug: custom-code
1013
- page: Capabilities
1114
path: ./capabilities.mdx
1215
slug: capabilities
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<Info>Before getting started, [read about how Fern SDKs use custom code and learn about the `.fernignore` file](/sdks/overview/custom-code).</Info>

fern/products/sdks/snippets/custom-code-intro.mdx

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)