Skip to content

Commit 619d693

Browse files
authored
(api definitions) Clarify protobuf spec setup, add protobuf generators reference (#1242)
1 parent b3ae9c1 commit 619d693

File tree

5 files changed

+42
-31
lines changed

5 files changed

+42
-31
lines changed

fern/products/api-def/api-def.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ navigation:
213213
- page: Error handling
214214
path: ./grpc-pages/services/errors.mdx
215215
slug: errors
216+
- page: generators.yml reference
217+
path: ./grpc-pages/reference/generators-reference.mdx
216218
- section: Fern Definition
217219
collapsed: true
218220
slug: ferndef

fern/products/api-def/grpc-pages/overview.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: gRPC is a high-performance RPC framework that uses Protocol Buffers
66
<Markdown src="/snippets/enterprise-plan.mdx"/>
77

88
<Note>
9-
Fern only supports gRPC SDK generation for .NET/C#.
9+
Fern only supports gRPC SDK generation for .NET/C#. Protobuf specs can be used for documentation generation in all languages.
1010
</Note>
1111

1212
gRPC is a modern, open-source, high-performance Remote Procedure Call (RPC) framework that can run in any environment. It uses Protocol Buffers (protobuf) as the interface definition language and supports multiple programming languages.
@@ -202,20 +202,21 @@ fern/
202202
```
203203
</Step>
204204
<Step title="Create a `generators.yml` file">
205-
Create a `generators.yml` file in your fern directory and add a reference to your gRPC proto files:
205+
Create a `generators.yml` file in your fern directory and add a reference to your gRPC proto files. See [gRPC generators.yml reference](/api-definitions/grpc/generators-yml-reference) for complete configuration options.
206206

207207
```yaml title="generators.yml"
208208
# Your API definition
209209
api:
210210
specs:
211211
- proto:
212-
root: ./proto
213-
target: ./proto/user_service.proto
214-
212+
# Path up to where package starts (e.g., for package userservice.v1)
213+
root: ../user-service/proto
214+
# Omit to generate docs for entire root folder
215+
target: ../user-service/proto/data/v1/user_service.proto
215216
groups:
216217
external:
217218
generators:
218-
# Your generator configurations here
219+
# Your C# generator configuration here, if relevant
219220
```
220221

221222
Your final directory structure:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: gRPC generators.yml reference
3+
description: Reference for configuring gRPC specifications in your generators.yml file
4+
---
5+
6+
Configure how your gRPC specification is processed and transformed into SDKs and documentation using the `generators.yml` configuration file.
7+
8+
<Markdown src="/snippets/grpc-specs.mdx" />

fern/products/sdks/reference/generators-yml-reference.mdx

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -226,31 +226,7 @@ api:
226226
</ParamField>
227227
</Accordion>
228228
<Accordion title="gRPC/proto buffers">
229-
230-
```yaml title="generators.yml"
231-
api:
232-
specs:
233-
- proto:
234-
root: "./proto"
235-
target: "proto/service/v1/service.proto"
236-
local-generation: true
237-
```
238-
239-
<ParamField path="root" type="string" required={true} toc={true}>
240-
Path to the `.proto` directory root (e.g., `proto`).
241-
</ParamField>
242-
243-
<ParamField path="target" type="string" toc={true}>
244-
Path to the target `.proto` file (e.g., `proto/user/v1/user.proto`).
245-
</ParamField>
246-
247-
<ParamField path="overrides" type="string" toc={true}>
248-
Path to the overrides configuration.
249-
</ParamField>
250-
251-
<ParamField path="local-generation" type="boolean" default="false" toc={true}>
252-
Whether to compile `.proto` files locally. Defaults to remote generation (`false`).
253-
</ParamField>
229+
<Markdown src="/snippets/grpc-specs.mdx" />
254230
</Accordion>
255231
<Accordion title="OpenRPC">
256232

fern/snippets/grpc-specs.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
```yaml title="generators.yml"
2+
api:
3+
specs:
4+
- proto:
5+
root: "./proto"
6+
target: "proto/service/v1/service.proto"
7+
local-generation: true
8+
```
9+
10+
<ParamField path="root" type="string" required={true} toc={true}>
11+
Path to the `.proto` directory root (e.g., `proto`). Must be specified up to where the package starts. For example, if your package is `package.test.v1` at the file path `protos/package/test/v1/test_file.proto`, the root should be `protos/`
12+
</ParamField>
13+
14+
<ParamField path="target" type="string" toc={true} required={false}>
15+
Path to the target `.proto` file (e.g., `proto/user/v1/user.proto`). Omit to generate docs for the entire root folder.
16+
</ParamField>
17+
18+
<ParamField path="overrides" type="string" toc={true}>
19+
Path to the overrides configuration file. Used for SDK generation only, not for documentation generation.
20+
</ParamField>
21+
22+
<ParamField path="local-generation" type="boolean" default="false" toc={true}>
23+
Whether to compile `.proto` files locally. Defaults to remote generation (`false`).
24+
</ParamField>

0 commit comments

Comments
 (0)