Skip to content

Commit a9cd9aa

Browse files
feat(openapi-typescript): Optional Export Root Type Aliases (openapi-ts#1876)
* Add root component type aliases * Add tests for root component types * Add root types CLI option docs * Add unit test for components root types * Add schema name conflict detection * Add tests for components root types beyond schemas * Add cross-component conflict checks * Update examples * Fix biome linting issues * Add changeset --------- Co-authored-by: bdh9 <[email protected]>
1 parent 5a227eb commit a9cd9aa

File tree

15 files changed

+119872
-799
lines changed

15 files changed

+119872
-799
lines changed

.changeset/late-geese-begin.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"openapi-typescript": minor
3+
---
4+
5+
Add option to export all root component types

docs/cli.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,22 @@ The following flags are supported in the CLI:
104104
| `--help` | | | Display inline help message and exit |
105105
| `--version` | | | Display this library’s version and exit |
106106
| `--output [location]` | `-o` | (stdout) | Where should the output file be saved? |
107-
| `--redocly [location]` | | | Path to a `redocly.yaml` file (see [Multiple schemas](#multiple-schemas)) |
107+
| `--redocly [location]` | | | Path to a `redocly.yaml` file (see [Multiple schemas](#multiple-schemas)) |
108108
| `--additional-properties` | | `false` | Allow arbitrary properties for all schema objects without `additionalProperties: false` |
109109
| `--alphabetize` | | `false` | Sort types alphabetically |
110110
| `--array-length` | | `false` | Generate tuples using array `minItems` / `maxItems` |
111-
| `--default-non-nullable` | | `true` | Treat schema objects with default values as non-nullable (with the exception of parameters) |
111+
| `--default-non-nullable` | | `true` | Treat schema objects with default values as non-nullable (with the exception of parameters) |
112112
| `--properties-required-by-default` | | `false` | Treat schema objects without `required` as having all properties required. |
113113
| `--empty-objects-unknown` | | `false` | Allow arbitrary properties for schema objects with no specified properties, and no specified `additionalProperties` |
114114
| `--enum` | | `false` | Generate true [TS enums](https://www.typescriptlang.org/docs/handbook/enums.html) rather than string unions. |
115115
| `--enum-values` | | `false` | Export enum values as arrays. |
116116
| `--dedupe-enums` | | `false` | Dedupe enum types when `--enum=true` is set |
117-
| `--check` | | `false` | Check that the generated types are up-to-date. |
117+
| `--check` | | `false` | Check that the generated types are up-to-date. |
118118
| `--exclude-deprecated` | | `false` | Exclude deprecated fields from types |
119119
| `--export-type` | `-t` | `false` | Export `type` instead of `interface` |
120120
| `--immutable` | | `false` | Generates immutable types (readonly properties and readonly array) |
121121
| `--path-params-as-types` | | `false` | Allow dynamic string lookups on the `paths` object |
122+
| `--root-types` | | `false` | Exports types from `components` as root level type aliases |
122123

123124
### pathParamsAsTypes
124125

0 commit comments

Comments
 (0)