You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/introduction.md
+4-5
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,9 @@ The code is <a href="https://github.com/drwpow/openapi-typescript/blob/main/pack
12
12
## Features
13
13
14
14
- ✅ Supports OpenAPI 3.0 and 3.1 (including advanced features like <ahref="https://spec.openapis.org/oas/v3.1.0#discriminator-object"target="_blank"rel="noopener noreferrer">discriminators</a>)
15
-
- ✅ Supports YAML and JSON
16
-
- ✅ Supports loading via remote URL (simple authentication supported with the `--auth` flag)
> ⚠️ Be sure to <ahref="(https://apitools.dev/swagger-cli/"target="_blank"rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will err on invalid schemas.
47
+
> ⚠️ Be sure to <ahref="https://redocly.com/docs/cli/commands/lint/"target="_blank"rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will err on invalid schemas.
49
48
50
49
Then, import schemas from the generated file like so:
> ⚠️ Be sure to <ahref="(https://apitools.dev/swagger-cli/"target="_blank"rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will err on invalid schemas.
64
+
> ⚠️ Be sure to <ahref="https://redocly.com/docs/cli/commands/lint/"target="_blank"rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will err on invalid schemas.
65
65
66
66
Lastly, be sure to **run typechecking** in your project. This can be done by adding `tsc --noEmit` to your <ahref="https://docs.npmjs.com/cli/v9/using-npm/scripts"target="_blank"rel="noopener noreferrer">npm scripts</a> like so:
> ⚠️ Be sure to <ahref="(https://apitools.dev/swagger-cli/"target="_blank"rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will err on invalid schemas.
59
+
> ⚠️ Be sure to <ahref="https://redocly.com/docs/cli/commands/lint/"target="_blank"rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will err on invalid schemas.
60
60
61
61
Lastly, be sure to **run typechecking** in your project. This can be done by adding `tsc --noEmit` to your <ahref="https://docs.npmjs.com/cli/v9/using-npm/scripts"target="_blank"rel="noopener noreferrer">npm scripts</a> like so:
- ✅ Fetches remote schemas quickly using [undici](https://www.npmjs.com/package/undici)
9
+
- ✅ Supports OpenAPI 3.0 and 3.1 (including advanced features like <ahref="https://spec.openapis.org/oas/v3.1.0#discriminator-object"target="_blank"rel="noopener noreferrer">discriminators</a>)
10
+
- ✅ Generate **runtime-free types** that outperform old-school codegen
11
+
- ✅ Load schemas from YAML or JSON, locally or remotely
12
+
- ✅ Native Node.js code is fast and generates types within milliseconds
14
13
15
14
**Examples**
16
15
17
16
👀 [See examples](./examples/)
18
17
19
18
## Usage
20
19
21
-
Note:️ openapiTS requires **VALID** OpenAPI 3.x schemas to work, and this library does not handle validation. There are several quality tools that handle this like [@apidevtools/swagger-parser](https://www.npmjs.com/package/@apidevtools/swagger-parser). Make sure to validate your schemas first!
20
+
First, generate a local type file by running `npx openapi-typescript`:
> ⚠️ Be sure to <ahref="https://redocly.com/docs/cli/commands/lint/"target="_blank"rel="noopener noreferrer">validate your schemas</a>! openapi-typescript will err on invalid schemas.
33
+
34
+
Then, import schemas from the generated file like so:
0 commit comments