Skip to content

Commit 66fb880

Browse files
authored
Add generators.yml reference page to OpenAPI section; document inline-all-of-schemas (API Definitions) (#578)
1 parent 830ad7a commit 66fb880

File tree

4 files changed

+120
-102
lines changed

4 files changed

+120
-102
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ navigation:
7272
- page: FastAPI
7373
path: ./openapi-pages/server-frameworks/fastapi.mdx
7474
slug: fastapi
75+
- page: generators.yml reference
76+
path: ./openapi-pages/reference/generators-reference.mdx
7577
- section: AsyncAPI
7678
collapsed: true
7779
slug: asyncapi
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: OpenAPI generators.yml reference
3+
description: Reference for configuring OpenAPI specifications in your generators.yml file
4+
---
5+
6+
Configure how your OpenAPI specification is processed and transformed into SDKs using the `generators.yml` configuration file.
7+
8+
<Markdown src="/snippets/openapi-specs.mdx" />

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

Lines changed: 2 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -171,109 +171,9 @@ api:
171171
172172
### Specification Types
173173
174-
#### OpenAPI
174+
#### OpenAPI
175175
176-
```yaml
177-
api:
178-
specs:
179-
- openapi: "./openapi.yml"
180-
origin: "https://api.example.com/openapi.json"
181-
overrides: "./openapi-overrides.yml"
182-
namespace: "v1"
183-
settings:
184-
title-as-schema-name: true
185-
inline-path-parameters: false
186-
prefer-undiscriminated-unions-with-literals: true
187-
filter:
188-
endpoints: ["POST /users", "GET /users/{id}"]
189-
example-generation:
190-
request:
191-
max-depth: 2
192-
```
193-
194-
<ParamField path="openapi" type="string" required={true} toc={true}>
195-
Path to the OpenAPI specification file.
196-
</ParamField>
197-
198-
<ParamField path="origin" type="string" toc={true}>
199-
URL of the API definition origin for polling updates.
200-
</ParamField>
201-
202-
<ParamField path="overrides" type="string" toc={true}>
203-
Path to OpenAPI overrides file.
204-
</ParamField>
205-
206-
<ParamField path="namespace" type="string" toc={true}>
207-
Namespace for the specification.
208-
</ParamField>
209-
210-
<ParamField path="settings" type="OpenAPISettingsSchema" toc={true}>
211-
OpenAPI-specific generation settings.
212-
</ParamField>
213-
214-
<ParamField path="title-as-schema-name" type="boolean" default="true" toc={true}>
215-
Whether to use the titles of schemas within an OpenAPI definition as the names of types within Fern.
216-
</ParamField>
217-
218-
<ParamField path="inline-path-parameters" type="boolean" default="false" toc={true}>
219-
Whether to include path parameters within the generated in-lined request.
220-
</ParamField>
221-
222-
<ParamField path="prefer-undiscriminated-unions-with-literals" type="boolean" default="false" toc={true}>
223-
Whether to prefer undiscriminated unions with literals.
224-
</ParamField>
225-
226-
<ParamField path="only-include-referenced-schemas" type="boolean" default="false" toc={true}>
227-
Whether to only include schemas referenced by endpoints in the generated SDK (tree-shaking).
228-
</ParamField>
229-
230-
<ParamField path="respect-nullable-schemas" type="boolean" default="false" toc={true}>
231-
Preserves nullable schemas in API definition settings. When false, nullable schemas are treated as optional.
232-
</ParamField>
233-
234-
<ParamField path="object-query-parameters" type="boolean" toc={true}>
235-
Enables parsing deep object query parameters.
236-
</ParamField>
237-
238-
<ParamField path="respect-readonly-schemas" type="boolean" toc={true}>
239-
Enables exploring readonly schemas in OpenAPI specifications.
240-
</ParamField>
241-
242-
<ParamField path="respect-forward-compatible-enums" type="boolean" default="false" toc={true}>
243-
Enables respecting forward compatible enums in OpenAPI specifications.
244-
</ParamField>
245-
246-
<ParamField path="use-bytes-for-binary-response" type="boolean" toc={true}>
247-
Enables using the `bytes` type for binary responses. Defaults to file stream.
248-
</ParamField>
249-
250-
<ParamField path="default-form-parameter-encoding" type="FormParameterEncoding" default="json" toc={true}>
251-
The default encoding of form parameters. Options: `form`, `json`.
252-
</ParamField>
253-
254-
<ParamField path="additional-properties-defaults-to" type="boolean" default="false" toc={true}>
255-
Configure what `additionalProperties` should default to when not explicitly defined on a schema.
256-
</ParamField>
257-
258-
<ParamField path="type-dates-as-strings" type="boolean" default="true" toc={true}>
259-
If true, convert strings with format date to strings. If false, convert to dates.
260-
</ParamField>
261-
262-
<ParamField path="preserve-single-schema-oneof" type="boolean" default="false" toc={true}>
263-
If true, preserve oneOf structures with a single schema. If false, unwrap them.
264-
</ParamField>
265-
266-
<ParamField path="filter.endpoints" type="list<string>" toc={true}>
267-
Endpoints to include in the generated SDK (e.g., "POST /users").
268-
</ParamField>
269-
270-
<ParamField path="example-generation.request.max-depth" type="integer" toc={true}>
271-
Controls the maximum depth for which optional properties will have examples generated. A depth of 0 means no optional properties will have examples.
272-
</ParamField>
273-
274-
<ParamField path="example-generation.response.max-depth" type="integer" toc={true}>
275-
Controls the maximum depth for which optional properties will have examples generated in responses.
276-
</ParamField>
176+
<Markdown src="/snippets/openapi-specs.mdx" />
277177
278178
#### AsyncAPI
279179

fern/snippets/openapi-specs.mdx

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
```yaml title="generators.yml"
2+
api:
3+
specs:
4+
- openapi: "./openapi.yml"
5+
origin: "https://api.example.com/openapi.json"
6+
overrides: "./openapi-overrides.yml"
7+
namespace: "v1"
8+
settings:
9+
title-as-schema-name: true
10+
inline-path-parameters: false
11+
inline-all-of-schemas: true
12+
prefer-undiscriminated-unions-with-literals: true
13+
filter:
14+
endpoints: ["POST /users", "GET /users/{id}"]
15+
example-generation:
16+
request:
17+
max-depth: 2
18+
```
19+
20+
<ParamField path="openapi" type="string" required={true} toc={true}>
21+
Path to the OpenAPI specification file.
22+
</ParamField>
23+
24+
<ParamField path="origin" type="string" toc={true}>
25+
URL of the API definition origin for polling updates.
26+
</ParamField>
27+
28+
<ParamField path="overrides" type="string" toc={true}>
29+
Path to OpenAPI overrides file.
30+
</ParamField>
31+
32+
<ParamField path="namespace" type="string" toc={true}>
33+
Namespace for the specification.
34+
</ParamField>
35+
36+
<ParamField path="settings" type="OpenAPISettingsSchema" toc={true}>
37+
OpenAPI-specific generation settings.
38+
</ParamField>
39+
40+
<ParamField path="title-as-schema-name" type="boolean" default="true" toc={true}>
41+
Whether to use the titles of schemas within an OpenAPI definition as the names of types within Fern.
42+
</ParamField>
43+
44+
<ParamField path="inline-path-parameters" type="boolean" default="false" toc={true}>
45+
Whether to include path parameters within the generated in-lined request.
46+
</ParamField>
47+
48+
<ParamField path="inline-all-of-schemas" type="boolean" default="false" toc={true}>
49+
Whether to inline `allOf` schemas during code generation. When true, Fern recursively visits `allOf` schema definitions and inlines them into the child schema. When false, `allOf` schemas are extended through inheritance.
50+
51+
Enabling this setting allows child schemas to override parent property requirements. For example, a child schema can mark a parent's required property as optional. Without this setting, Fern ignores the child schema's optional declaration and preserves the parent schema's requirement instead.
52+
</ParamField>
53+
54+
<ParamField path="prefer-undiscriminated-unions-with-literals" type="boolean" default="false" toc={true}>
55+
Whether to prefer undiscriminated unions with literals.
56+
</ParamField>
57+
58+
<ParamField path="only-include-referenced-schemas" type="boolean" default="false" toc={true}>
59+
Whether to only include schemas referenced by endpoints in the generated SDK (tree-shaking).
60+
</ParamField>
61+
62+
<ParamField path="respect-nullable-schemas" type="boolean" default="false" toc={true}>
63+
Preserves nullable schemas in API definition settings. When false, nullable schemas are treated as optional.
64+
</ParamField>
65+
66+
<ParamField path="object-query-parameters" type="boolean" toc={true}>
67+
Enables parsing deep object query parameters.
68+
</ParamField>
69+
70+
<ParamField path="respect-readonly-schemas" type="boolean" toc={true}>
71+
Enables exploring readonly schemas in OpenAPI specifications.
72+
</ParamField>
73+
74+
<ParamField path="respect-forward-compatible-enums" type="boolean" default="false" toc={true}>
75+
Enables respecting forward compatible enums in OpenAPI specifications.
76+
</ParamField>
77+
78+
<ParamField path="use-bytes-for-binary-response" type="boolean" toc={true}>
79+
Enables using the `bytes` type for binary responses. Defaults to file stream.
80+
</ParamField>
81+
82+
<ParamField path="default-form-parameter-encoding" type="FormParameterEncoding" default="json" toc={true}>
83+
The default encoding of form parameters. Options: `form`, `json`.
84+
</ParamField>
85+
86+
<ParamField path="additional-properties-defaults-to" type="boolean" default="false" toc={true}>
87+
Configure what `additionalProperties` should default to when not explicitly defined on a schema.
88+
</ParamField>
89+
90+
<ParamField path="type-dates-as-strings" type="boolean" default="true" toc={true}>
91+
If true, convert strings with format date to strings. If false, convert to dates.
92+
</ParamField>
93+
94+
<ParamField path="preserve-single-schema-oneof" type="boolean" default="false" toc={true}>
95+
If true, preserve oneOf structures with a single schema. If false, unwrap them.
96+
</ParamField>
97+
98+
<ParamField path="filter.endpoints" type="list<string>" toc={true}>
99+
Endpoints to include in the generated SDK (e.g., "POST /users").
100+
</ParamField>
101+
102+
<ParamField path="example-generation.request.max-depth" type="integer" toc={true}>
103+
Controls the maximum depth for which optional properties will have examples generated. A depth of 0 means no optional properties will have examples.
104+
</ParamField>
105+
106+
<ParamField path="example-generation.response.max-depth" type="integer" toc={true}>
107+
Controls the maximum depth for which optional properties will have examples generated in responses.
108+
</ParamField>

0 commit comments

Comments
 (0)