Skip to content

Commit faab920

Browse files
authored
Make various edits to Go and PHP docs based on feedback (#125)
1 parent d7a368b commit faab920

19 files changed

+173
-121
lines changed

fern/products/sdks/overview/csharp/publishing-to-nuget.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ you'll have a versioned package published on NuGet.
1212
<img src="assets/dotnet-package.png" alt="Versioned package published on NuGet" />
1313
</Frame>
1414

15-
<Info>This guide assumes that you already have an initialized `fern` folder on your local machine. If you don’t, run `fern init`. See [.NET Quickstart](quickstart.mdx) for more details.</Info>
15+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
1616

1717
## Set up your GitHub integration
1818

fern/products/sdks/overview/csharp/quickstart.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Get started quickly with the Fern .NET SDK.
55

66
Generate a C#/.NET SDK by following the instructions on this page.
77

8-
<Markdown src="/products/sdks/snippets/quickstart-prereqs.mdx"/>
8+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
99

1010
<Steps>
1111

@@ -16,13 +16,20 @@ Generate a C#/.NET SDK by following the instructions on this page.
1616
Add the C#/.NET SDK generator:
1717

1818
```bash
19-
fern add fern-csharp-sdk --group sdk
19+
fern add fern-csharp-sdk --group csharp-sdk
2020
```
2121

22+
<Note>
23+
`csharp-sdk` is the name of the `generators.yml` group that configures your C#/.NET
24+
SDK's output location and other metadata. You can customize this group name to
25+
differentiate between multiple SDKs across different languages (e.g.,
26+
`ruby-sdk`, etc) in your organization.
27+
</Note>
28+
2229
This command adds the following to `generators.yml`:
2330

2431
```yaml
25-
sdk:
32+
csharp-sdk:
2633
generators:
2734
- name: fernapi/fern-csharp-sdk
2835
version: <Markdown src="/snippets/version-number.mdx"/>
@@ -35,7 +42,7 @@ This command adds the following to `generators.yml`:
3542
3643
```bash
3744
fern/ # created by fern init
38-
sdks/ # created by fern generate --group sdk
45+
sdks/ # created by fern generate --group csharp-sdk
3946
├─ csharp
4047
└─ src/
4148
├─ YourOrganizationApi.sln

fern/products/sdks/overview/go/configuration.mdx

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -117,43 +117,6 @@ with the relevant elements in your `go.mod` path. In this case, the generated Go
117117
<ParamField path="clientName" type="string" required={false}>
118118
</ParamField>
119119

120-
<ParamField path="enableExplicitNull" type="boolean" required={false}>
121-
By default, it's impossible to send an explicit JSON `null` for optional parameters. `enableExplicitNull: true` opts in to generating a generic `Optional[T]` type that can be used to distinguish between a `nil` value (nothing is sent), a non-`nil` value (the value is sent), and an explicit null (a `null` value is sent). This is particularly useful for `PATCH` endpoints.
122-
123-
The `Optional` and `Null` constructor functions will be included at the root of your module and can be
124-
used like so:
125-
126-
```go
127-
client := acmeclient.NewClient()
128-
updatedFoo, err := client.Foo.Update(
129-
context.TODO(),
130-
&acme.UpdateFooRequest{
131-
Name: acme.Optional("example"),
132-
Tag: acme.Null[string](),
133-
},
134-
// Serialized as {"name":"example","tag":null}
135-
)
136-
```
137-
138-
An example configuration:
139-
140-
```yaml {7-8}
141-
default-group: local
142-
groups:
143-
local:
144-
generators:
145-
- name: fernapi/fern-go-sdk
146-
version: 0.13.0
147-
config:
148-
enableExplicitNull: true
149-
output:
150-
location: local-file-system
151-
path: ../generated/go
152-
```
153-
154-
<Note>This feature requires generics, so the generated `go.mod` will be upgraded to `1.18` (as opposed to `1.13`).</Note>
155-
</ParamField>
156-
157120
<ParamField path="exportedClientName" type="string" required={false}>
158121
</ParamField>
159122

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ description: Augment your Go SDK with custom utilities
3535
<Markdown src="/products/sdks/snippets/consume-method.mdx"/>
3636

3737
```go
38-
import "github.com/package/example"
38+
import "github.com/package/example"
3939

40-
example.MyHelper();
40+
example.MyHelper();
4141
```
4242
</Steps>
4343

@@ -50,10 +50,10 @@ description: Augment your Go SDK with custom utilities
5050
Name your Fern-generated client something like `BaseClient` to reflect that this client will be extended.
5151

5252
```yml {4} title="generators.yml"
53-
- name: fernapi/fern-java-sdk
53+
- name: fernapi/fern-go-sdk
5454
version: "..."
5555
config:
56-
client-class-name: BaseClient
56+
clientName: BaseClient
5757
```
5858
5959
### Import and extend the generated client

fern/products/sdks/overview/go/publishing-to-go-package-manager.mdx

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
---
22
title: Publishing to Pkgsite
3-
description: How to publish the Fern Go SDK to Pkgsite.
3+
description: How to publish the Fern Go SDK to the Go module proxy.
44
---
55

6-
Publish your public-facing Fern GO SDK to the [Pkgsite
7-
registry](https://pkg.go.dev/). After following the steps on this page,
8-
you'll have a versioned package published on Pkgsite.
6+
Publish your public-facing Fern Go SDK to
7+
[pkg.go.dev](https://proxy.golang.org/). After following the steps on this page,
8+
you'll have a versioned package published on pkg.go.dev.
99

1010
<Frame>
1111
<img src="assets/go-package.png" alt="Versioned package published on Pkgsite" />
1212
</Frame>
1313

14-
<Info>This guide assumes that you already have an initialized `fern` folder on your local machine. If you don’t, run `fern init`. See [Go Quickstart](quickstart.mdx) for more details.</Info>
15-
14+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
1615

1716
## Set up your GitHub integration
1817

1918
1. Create a new GitHub repository called `company-go` (or something similar) for your SDK, if you haven't done so already. Make sure your repository has:
2019
* **Public** visibility
21-
* A required license (e.g. [MIT](https://opensource.org/license/mit), [Apache](https://www.apache.org/licenses/LICENSE-2.0)) to the repository.
20+
* An [approved license](https://pkg.go.dev/license-policy) (e.g. [MIT](https://opensource.org/license/mit), [Apache](https://www.apache.org/licenses/LICENSE-2.0))
2221
1. Install the [Fern GitHub App](https://github.com/apps/fern-api): Select **Configure**, then scroll down to **Repository Access**. Select **Only select repositories** and in the dropdown select the repository for your SDK. Click **Save**.
2322

2423

@@ -42,15 +41,15 @@ you'll have a versioned package published on Pkgsite.
4241
```yaml {2-11}
4342
groups:
4443
go-sdk:
45-
generators:
46-
- name: fernapi/fern-go-sdk
47-
version: <Markdown src="/snippets/version-number.mdx"/>
48-
output:
49-
location: local-file-system
50-
path: ../sdks/go
51-
config:
52-
module:
53-
path: sdk
44+
generators:
45+
- name: fernapi/fern-go-sdk
46+
version: <Markdown src="/snippets/version-number.mdx"/>
47+
output:
48+
location: local-file-system
49+
path: ../sdks/go
50+
config:
51+
module:
52+
path: sdk
5453
```
5554
5655
</Step>
@@ -76,15 +75,15 @@ you'll have a versioned package published on Pkgsite.
7675
</Steps>
7776

7877

79-
## Release your SDK to Pkgsite
78+
## Publish to pkg.go.dev
8079

8180
At this point, you're ready to generate a release for your SDK.
8281

8382
<Steps>
8483

8584
<Step title="Generate your release">
8685

87-
Regenerate your SDK and publish it on PyPI:
86+
Regenerate your SDK and publish it on pkg.go.dev:
8887

8988
```bash
9089
fern generate --group go-sdk --version <version>
@@ -94,17 +93,20 @@ you'll have a versioned package published on Pkgsite.
9493

9594
</Step>
9695

97-
<Step title="Publish on Pkgsite">
96+
<Step title="Publish on pkg.go.dev">
9897

9998
Navigate to `https://pkg.go.dev/github.com/<github-org>/<github-repo-name>/` and send a request to index your package. In a few minutes, your new release should be published to [https://pkg.go.dev/](https://pkg.go.dev/)!
10099

101-
<Tip>After releasing a new version, it may take a few minutes for Pkgsite
102-
to index and display the update. You can also try checking to see if the Go
103-
proxy has indexed your module at
104-
`https://proxy.golang.org/github.com/<github-org>/<github-repo-name>/@v/list`. Pkgsite
105-
indexing usually happens within 5-15 min of the proxy picking it up. For
106-
more information, see Go's documentation on [Adding a
107-
package](https://pkg.go.dev/about#adding-a-package). </Tip>
100+
<Tip>
101+
After releasing a new version, it may take a few minutes for pkg.go.dev
102+
to index and display the update. You can also try checking to see if the Go
103+
proxy has indexed your module at
104+
`https://proxy.golang.org/github.com/<github-org>/<github-repo-name>/@v/list`. pkg.go.dev
105+
indexing usually happens within 5-15 min of the proxy picking it up.
106+
107+
For more information, see Go's documentation on [Adding a
108+
package](https://pkg.go.dev/about#adding-a-package).
109+
</Tip>
108110

109111
</Step>
110112

fern/products/sdks/overview/go/quickstart.mdx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Get started quickly with the Fern Go SDK.
55

66
Generate a Go SDK by following the instructions on this page.
77

8-
<Markdown src="/products/sdks/snippets/quickstart-prereqs.mdx"/>
8+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
99

1010
<Steps>
1111

@@ -16,13 +16,19 @@ Generate a Go SDK by following the instructions on this page.
1616
Add the Go SDK generator:
1717

1818
```bash
19-
fern add fern-go-sdk --group sdk
19+
fern add fern-go-sdk --group go-sdk
2020
```
21+
<Note>
22+
`go-sdk` is the name of the `generators.yml` group that configures your Go
23+
SDK's output location and other metadata. You can customize this group name to
24+
differentiate between multiple SDKs across different languages (e.g.,
25+
`ruby-sdk`, etc) in your organization.
26+
</Note>
2127

2228
This command adds the following to `generators.yml`:
2329

2430
```yaml
25-
sdk:
31+
go-sdk:
2632
generators:
2733
- name: fernapi/fern-go-sdk
2834
version: <Markdown src="/snippets/version-number.mdx"/>
@@ -31,13 +37,21 @@ This command adds the following to `generators.yml`:
3137
path: ../sdks/go
3238
```
3339
34-
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
40+
### Generate the SDK
41+
42+
Generate the SDK:
43+
44+
```bash
45+
fern generate --group go-sdk
46+
```
47+
48+
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
3549

3650
```bash
3751
fern/ # created by fern init
38-
sdks/ # created by fern generate --group sdk
52+
sdks/ # created by fern generate --group go-sdk
3953
├─ go
4054
├─ core/
41-
└─ resources/
55+
└─ go.mod
4256
```
4357
</Steps>

fern/products/sdks/overview/java/publishing-to-maven-central.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Publish your public-facing Fern Java SDK to the [Maven Central
77
registry](https://pypi.org/). After following the steps on this page,
88
you'll have a versioned package published on Maven Central.
99

10-
<Info>This guide assumes that you already have an initialized `fern` folder on your local machine. If you don’t, run `fern init`. See [Java Quickstart](quickstart.mdx) for more details.</Info>
10+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
1111

1212
## Set up your GitHub integration
1313

fern/products/sdks/overview/java/quickstart.mdx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Get started quickly with the Fern Java SDK.
55

66
Generate a Java SDK by following the instructions on this page.
77

8-
<Markdown src="/products/sdks/snippets/quickstart-prereqs.mdx"/>
8+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
99

1010
<Steps>
1111

@@ -16,13 +16,19 @@ Generate a Java SDK by following the instructions on this page.
1616
Add the Java SDK generator:
1717

1818
```bash
19-
fern add fern-java-sdk --group sdk
19+
fern add fern-java-sdk --group java-sdk
2020
```
21+
<Note>
22+
`java-sdk` is the name of the `generators.yml` group that configures your Java
23+
SDK's output location and other metadata. You can customize this group name to
24+
differentiate between multiple SDKs across different languages (e.g.,
25+
`ruby-sdk`, etc) in your organization.
26+
</Note>
2127

2228
This command adds the following to `generators.yml`:
2329

2430
```yaml
25-
sdk:
31+
java-sdk:
2632
generators:
2733
- name: fernapi/fern-java-sdk
2834
version: <Markdown src="/snippets/version-number.mdx"/>
@@ -31,11 +37,19 @@ This command adds the following to `generators.yml`:
3137
path: ../sdks/java
3238
```
3339
34-
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
40+
### Generate the SDK
41+
42+
Generate the SDK:
43+
44+
```bash
45+
fern generate --group java-sdk
46+
```
47+
48+
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
3549

3650
```bash
3751
fern/ # created by fern init
38-
sdks/ # created by fern generate --group sdk
52+
sdks/ # created by fern generate --group java-sdk
3953
├─ java
4054
├─ YourOrganizationApiClient.java
4155
├─ core/

fern/products/sdks/overview/php/publishing-to-packagist.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ you'll have a versioned package published on Packagist.
1111
<img src="assets/packagist-package.png" alt="Versioned package published on Packagist" />
1212
</Frame>
1313

14-
<Info>This guide assumes that you already have an initialized `fern` folder on your local machine. If you don’t, run `fern init`. See [PHP Quickstart](quickstart.mdx) for more details.</Info>
14+
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>
1515

1616
## Set up your GitHub integration
1717

0 commit comments

Comments
 (0)