@@ -56,6 +56,12 @@ npx @manifoldco/swagger-to-ts schema.yaml --wrapper "declare namespace API"
56
56
npx @manifoldco/swagger-to-ts schema.yaml --wrapper " declare module '@api'"
57
57
```
58
58
59
+ By default, wrapper is ` declare namespace OpenAPI2 ` . You can skip exposing types via a wrapper by adding the ` --nowrapper ` flag:
60
+
61
+ ``` bash
62
+ npx @manifoldco/swagger-to-ts schema.yaml --nowrapper
63
+ ```
64
+
59
65
As mentioned before, this uses [ Prettier] [ prettier ] to clean up output, so
60
66
extra spaces are generally OK here. Prettier also will err on cleanup if you
61
67
specify invalid TypeScript, letting you know on generation if anything went
@@ -102,6 +108,7 @@ also use the Node API (below).
102
108
| ` --output [location] ` | ` -o ` | (stdout) | Where should the output file be saved? |
103
109
| ` --swagger [version] ` | ` -s ` | ` 2 ` | Which Swagger version to use. Currently only supports ` 2 ` . |
104
110
| ` --camelcase ` | ` -c ` | ` false ` | Convert ` snake_case ` properties to ` camelCase ` ? |
111
+ | ` --nowrapper ` | ` -nw ` | ` false ` | Disables rendering a wrapper |
105
112
106
113
### Node
107
114
@@ -128,11 +135,11 @@ specs, [glob][glob] may also come in handy.
128
135
129
136
#### Node Options
130
137
131
- | Name | Type | Default | Description |
132
- | :---------- | :-------: | :--------------------------: | :--------------------------------------------------------- |
133
- | ` wrapper ` | ` string ` | ` declare namespace OpenAPI2 ` | How should this export the types? |
134
- | ` swagger ` | ` number ` | ` 2 ` | Which Swagger version to use. Currently only supports ` 2 ` . |
135
- | ` camelcase ` | ` boolean ` | ` false ` | Convert ` snake_case ` properties to ` camelCase ` |
138
+ | Name | Type | Default | Description |
139
+ | :---------- | :--------------- : | :--------------------------: | :----------------- --------------------------------------------------------- |
140
+ | ` wrapper ` | ` string \| false ` | ` declare namespace OpenAPI2 ` | How should this export the types? Pass false to disable rendering a wrapper |
141
+ | ` swagger ` | ` number ` | ` 2 ` | Which Swagger version to use. Currently only supports ` 2 ` . |
142
+ | ` camelcase ` | ` boolean ` | ` false ` | Convert ` snake_case ` properties to ` camelCase ` |
136
143
137
144
[ glob ] : https://www.npmjs.com/package/glob
138
145
[ js-yaml ] : https://www.npmjs.com/package/js-yaml
0 commit comments