Skip to content
Open
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
20 changes: 16 additions & 4 deletions fern/products/sdks/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,28 @@ description: Generate idiomatic SDKs in multiple programming languages
</div>
</div>
</a>
<a class="fern-card interactive not-prose relative block p-6 text-base" href="https://buildwithfern.com/book-demo?type=language-request">
<a class="fern-card interactive not-prose relative block p-6 text-base" href="/sdks/generators/rust/quickstart">
<div class="flex items-start flex-col space-y-3">
<img class="mx-auto dark:hidden" alt="Request Rust" src="./images/rust-card.png" />
<img class="mx-auto hidden dark:block" alt="Request Rust" src="./images/rust-card-dark.png" />
<div class="w-full space-y-1 overflow-hidden">
<img class="mx-auto dark:hidden" alt="Rust" src="./images/rust-card.png" />
<img class="mx-auto hidden dark:block" alt="Rust" src="./images/rust-card-dark.png" />
<div class="w-full space-y-1 overflow-hidden flex justify-between items-center">
<div class="text-(color:--grayscale-a12) text-body text-base font-semibold card-title">
Rust
<img src="./images/arrow-right-black.svg" alt="Arrow right light" className="arrow-right dark:hidden m-0" noZoom />
<img src="./images/arrow-right-white.svg" alt="Arrow right light" className="arrow-right hidden dark:block m-0" noZoom />
</div>
<div class="flex items-center gap-2">
<div class="text-(color:--grayscale-a10) text-body text-base font-light">
v<Markdown src="/snippets/version-number-rust.mdx"/>
</div>
<a class="changelog-button text-(color:--grayscale-a12) text-body text-base font-light" href="/sdks/generators/rust/changelog">
<img src="./images/icons/changelog-icon.svg" alt="Changelog" className="m-0 dark:hidden" noZoom />
<img src="./images/icons/changelog-icon-dark.svg" alt="Changelog" className="m-0 hidden dark:block" noZoom />
<div class="text-(color:--grayscale-a12) text-body text-base font-light">
Changelog
</div>
</a>
</div>
</div>
</div>
</a>
Expand Down
25 changes: 25 additions & 0 deletions fern/products/sdks/overview/rust/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Rust configuration
description: Configuration options for the Fern Rust SDK.
---

You can customize the behavior of the Rust SDK generator in `generators.yml`:

```yaml {6-8} title="generators.yml"
groups:
rust-sdk:
generators:
- name: fernapi/fern-rust-sdk
version: <Markdown src="/snippets/version-number-rust.mdx"/>
config:
clientName: PlantStoreClient
enableWireTests: true
```

<ParamField path="clientName" type="string" required={false} toc={true}>
The name of the generated client struct. This determines the primary client type name that users will interact with in the generated Rust SDK.
</ParamField>

<ParamField path="enableWireTests" type="boolean" default="true" required={false} toc={true}>
Generates [mock server (wire) tests](/sdks/deep-dives/testing#mock-server-tests) to verify that the SDK sends the correct HTTP requests and correctly handles responses per the API spec. When enabled, the generated tests use WireMock for HTTP mocking.
</ParamField>
71 changes: 71 additions & 0 deletions fern/products/sdks/overview/rust/quickstart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
title: Rust quickstart
description: Get started with the Fern Rust SDK.
---

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

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

<Steps>

<Markdown src="/products/sdks/snippets/pass-fern-check.mdx"/>

### Add the SDK generator

Run the following command to add the Rust SDK generator to `generators.yml`:

```bash
fern add fern-rust-sdk --group rust-sdk
```
<Note>
`rust-sdk` is the name of the `generators.yml` group that configures your Rust
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 `group` to `generators.yml`:

```yaml title="generators.yml"
rust-sdk: # group name
generators:
- name: fernapi/fern-rust-sdk
version: <Markdown src="/snippets/version-number-rust.mdx"/>
output:
location: local-file-system
path: ../sdks/rust
```

### Generate the SDK

Run the following command to generate your SDK:

```bash
fern generate --group rust-sdk
```

<Note>
If you have multiple APIs, use the [`--api` flag](/cli-api-reference/cli-reference/commands#api) to specify the API you want to generate:

```bash
fern generate --group rust-sdk --api your-api-name
```
</Note>

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

<Files>
<Folder name="fern" comment="created by fern init" />
<Folder name="sdks" defaultOpen comment="created by fern generate --group rust-sdk">
<Folder name="rust" defaultOpen>
<File name="Cargo.toml" />
<Folder name="src" defaultOpen>
<File name="lib.rs" />
<File name="client.rs" />
<Folder name="types" />
</Folder>
</Folder>
</Folder>
</Files>
</Steps>
2 changes: 2 additions & 0 deletions fern/products/sdks/reference/generators-yml-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ groups:
</Card>
<Card title="Swift" href="/sdks/generators/swift/configuration">
</Card>
<Card title="Rust" href="/sdks/generators/rust/configuration">
</Card>
</CardGroup>


Expand Down
10 changes: 10 additions & 0 deletions fern/products/sdks/sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ navigation:
slug: publishing
- changelog: ./overview/swift/changelog
slug: changelog
- section: Rust
contents:
- page: Quickstart
path: ./overview/rust/quickstart.mdx
slug: quickstart
- page: Configuration
path: ./overview/rust/configuration.mdx
slug: configuration
- changelog: ./overview/rust/changelog
slug: changelog
- section: Postman
contents:
- page: Quickstart
Expand Down
1 change: 1 addition & 0 deletions fern/snippets/version-number-rust.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.13.4
Loading