Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fern/products/sdks/overview/csharp/publishing-to-nuget.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ you'll have a versioned package published on NuGet.
<img src="assets/dotnet-package.png" alt="Versioned package published on NuGet" />
</Frame>

<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>
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>

## Set up your GitHub integration

Expand Down
15 changes: 11 additions & 4 deletions fern/products/sdks/overview/csharp/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Get started quickly with the Fern .NET SDK.

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

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

<Steps>

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

```bash
fern add fern-csharp-sdk --group sdk
fern add fern-csharp-sdk --group csharp-sdk
```

<Note>
`csharp-sdk` is the name of the `generators.yml` group that configures your C#/.NET
SDK's output location and other metadata. You can customize this group name to
differentiate between multiple SDKs across different languages (e.g.,
`ruby-sdk`, etc) in your organization.
</Note>

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

```yaml
sdk:
csharp-sdk:
generators:
- name: fernapi/fern-csharp-sdk
version: <Markdown src="/snippets/version-number.mdx"/>
Expand All @@ -35,7 +42,7 @@ This command adds the following to `generators.yml`:

```bash
fern/ # created by fern init
sdks/ # created by fern generate --group sdk
sdks/ # created by fern generate --group csharp-sdk
├─ csharp
└─ src/
├─ YourOrganizationApi.sln
Expand Down
37 changes: 0 additions & 37 deletions fern/products/sdks/overview/go/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,43 +117,6 @@ with the relevant elements in your `go.mod` path. In this case, the generated Go
<ParamField path="clientName" type="string" required={false}>
</ParamField>

<ParamField path="enableExplicitNull" type="boolean" required={false}>
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.

The `Optional` and `Null` constructor functions will be included at the root of your module and can be
used like so:

```go
client := acmeclient.NewClient()
updatedFoo, err := client.Foo.Update(
context.TODO(),
&acme.UpdateFooRequest{
Name: acme.Optional("example"),
Tag: acme.Null[string](),
},
// Serialized as {"name":"example","tag":null}
)
```

An example configuration:

```yaml {7-8}
default-group: local
groups:
local:
generators:
- name: fernapi/fern-go-sdk
version: 0.13.0
config:
enableExplicitNull: true
output:
location: local-file-system
path: ../generated/go
```

<Note>This feature requires generics, so the generated `go.mod` will be upgraded to `1.18` (as opposed to `1.13`).</Note>
</ParamField>

<ParamField path="exportedClientName" type="string" required={false}>
</ParamField>

Expand Down
8 changes: 4 additions & 4 deletions fern/products/sdks/overview/go/custom-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ description: Augment your Go SDK with custom utilities
<Markdown src="/products/sdks/snippets/consume-method.mdx"/>

```go
import "github.com/package/example"
import "github.com/package/example"

example.MyHelper();
example.MyHelper();
```
</Steps>

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

```yml {4} title="generators.yml"
- name: fernapi/fern-java-sdk
- name: fernapi/fern-go-sdk
version: "..."
config:
client-class-name: BaseClient
clientName: BaseClient
```

### Import and extend the generated client
Expand Down
54 changes: 28 additions & 26 deletions fern/products/sdks/overview/go/publishing-to-go-package-manager.mdx
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
---
title: Publishing to Pkgsite
description: How to publish the Fern Go SDK to Pkgsite.
description: How to publish the Fern Go SDK to the Go module proxy.
---

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

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

<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>

<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>

## Set up your GitHub integration

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:
* **Public** visibility
* A required license (e.g. [MIT](https://opensource.org/license/mit), [Apache](https://www.apache.org/licenses/LICENSE-2.0)) to the repository.
* 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))
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**.


Expand All @@ -42,15 +41,15 @@ you'll have a versioned package published on Pkgsite.
```yaml {2-11}
groups:
go-sdk:
generators:
- name: fernapi/fern-go-sdk
version: <Markdown src="/snippets/version-number.mdx"/>
output:
location: local-file-system
path: ../sdks/go
config:
module:
path: sdk
generators:
- name: fernapi/fern-go-sdk
version: <Markdown src="/snippets/version-number.mdx"/>
output:
location: local-file-system
path: ../sdks/go
config:
module:
path: sdk
```

</Step>
Expand All @@ -76,15 +75,15 @@ you'll have a versioned package published on Pkgsite.
</Steps>


## Release your SDK to Pkgsite
## Publish to pkg.go.dev

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

<Steps>

<Step title="Generate your release">

Regenerate your SDK and publish it on PyPI:
Regenerate your SDK and publish it on pkg.go.dev:

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

</Step>

<Step title="Publish on Pkgsite">
<Step title="Publish on pkg.go.dev">

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/)!

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

For more information, see Go's documentation on [Adding a
package](https://pkg.go.dev/about#adding-a-package).
</Tip>

</Step>

Expand Down
26 changes: 20 additions & 6 deletions fern/products/sdks/overview/go/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Get started quickly with the Fern Go SDK.

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

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

<Steps>

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

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

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

```yaml
sdk:
go-sdk:
generators:
- name: fernapi/fern-go-sdk
version: <Markdown src="/snippets/version-number.mdx"/>
Expand All @@ -31,13 +37,21 @@ This command adds the following to `generators.yml`:
path: ../sdks/go
```

<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
### Generate the SDK

Generate the SDK:

```bash
fern generate --group go-sdk
```

<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>

```bash
fern/ # created by fern init
sdks/ # created by fern generate --group sdk
sdks/ # created by fern generate --group go-sdk
├─ go
├─ core/
└─ resources/
└─ go.mod
```
</Steps>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Publish your public-facing Fern Java SDK to the [Maven Central
registry](https://pypi.org/). After following the steps on this page,
you'll have a versioned package published on Maven Central.

<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>
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>

## Set up your GitHub integration

Expand Down
24 changes: 19 additions & 5 deletions fern/products/sdks/overview/java/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Get started quickly with the Fern Java SDK.

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

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

<Steps>

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

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

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

```yaml
sdk:
java-sdk:
generators:
- name: fernapi/fern-java-sdk
version: <Markdown src="/snippets/version-number.mdx"/>
Expand All @@ -31,11 +37,19 @@ This command adds the following to `generators.yml`:
path: ../sdks/java
```

<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
### Generate the SDK

Generate the SDK:

```bash
fern generate --group java-sdk
```

<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>

```bash
fern/ # created by fern init
sdks/ # created by fern generate --group sdk
sdks/ # created by fern generate --group java-sdk
├─ java
├─ YourOrganizationApiClient.java
├─ core/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ you'll have a versioned package published on Packagist.
<img src="assets/packagist-package.png" alt="Versioned package published on Packagist" />
</Frame>

<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>
<Markdown src="/products/sdks/snippets/setup-fern-folder-callout.mdx"/>

## Set up your GitHub integration

Expand Down
Loading