Skip to content

Commit 000f61e

Browse files
committed
update versioned apis info
1 parent a527d61 commit 000f61e

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

fern/products/api-def/pages/project-structure.mdx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -125,59 +125,59 @@ api:
125125
openapi: payments-api/openapi.yml
126126
```
127127
</Accordion>
128-
<Accordion title="Versioned APIs in the same SDK">
128+
<Accordion title="Versioned APIs">
129129
130-
Use this approach when you need to support multiple API versions simultaneously in your SDK.
130+
When supporting multiple API versions, you can publish them as separate packages or combine them into a single package with namespaces.
131131
132-
#### Option 1: Branch-based versioning
132+
#### Option 1: Separate packages for each API version
133133
134-
Each API version is maintained as a separate spec that publishes to a different branch of a single SDK repository. This approach allows you to release updates for older API versions independently and manage each as a different major version of your SDK (v1.x.x, v2.x.x).
134+
Use this approach when you want each API version to be independently installable (e.g., `@company/sdk-v1`, `@company/sdk-v2`).
135135

136136
```bash
137-
fern/
138-
├─ fern.config.json
139-
└─ apis/
140-
├─ v1/
141-
│ ├─ generators.yml # Configures v1 SDK
142-
│ └─ openapi.yml
137+
# Each API version in its own directory
138+
v1-sdk/
139+
└─ fern/
140+
├─ fern.config.json
141+
├─ generators.yml
142+
└─ v1/
143+
└─ openapi.yml
144+
v2-sdk/
145+
└─ fern/
146+
├─ fern.config.json
147+
├─ generators.yml
143148
└─ v2/
144-
├─ generators.yml # Configures v2 SDK
145149
└─ openapi.yml
146150
```
147151

148-
Each API version must have its own `generators.yml` file that targets a [specific branch](/sdks/reference/generators-yml#github):
152+
Each API version must have its own `generators.yml` file:
149153

150154
<Tabs>
151-
<Tab title="apis/v1/generators.yml">
155+
<Tab title="v1-sdk/fern/generators.yml">
152156

153-
```yaml title="apis/v1/generators.yml" {11}
157+
```yaml title="v1-sdk/fern/generators.yml"
154158
api:
155159
specs:
156-
- openapi: openapi.yml
160+
- openapi: v1/openapi.yml
157161
groups:
158162
ts-sdk:
159163
generators:
160164
- name: fernapi/fern-typescript-sdk
161165
github:
162-
repository: company/sdk
163-
mode: push
164-
branch: v1 # Targets v1 branch
166+
repository: company/sdk-v1
165167
```
166168
</Tab>
167-
<Tab title="apis/v2/generators.yml">
169+
<Tab title="v2-sdk/fern/generators.yml">
168170

169-
```yaml title="apis/v2/generators.yml" {11}
171+
```yaml title="v2-sdk/fern/generators.yml"
170172
api:
171173
specs:
172-
- openapi: openapi.yml
174+
- openapi: v2/openapi.yml
173175
groups:
174176
ts-sdk:
175177
generators:
176178
- name: fernapi/fern-typescript-sdk
177179
github:
178-
repository: company/sdk
179-
mode: pull-request
180-
branch: v2 # Targets v2 branch
180+
repository: company/sdk-v2
181181
```
182182
</Tab>
183183
</Tabs>

0 commit comments

Comments
 (0)