Skip to content

Commit b3c87f8

Browse files
committed
Enable warning by default
1 parent a774553 commit b3c87f8

15 files changed

+895
-112
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
example/*.ts

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ For anything more complicated, or for generating specs dynamically, you can also
9999

100100
#### CLI Options
101101

102-
| Option | Alias | Default | Description |
103-
| :-------------------- | :---- | :--------------------------: | :----------------------------------------------------------------------- |
104-
| `--wrapper` | `-w` | `declare namespace OpenAPI2` | How should this export the types? |
105-
| `--output [location]` | `-o` | (stdout) | Where should the output file be saved? |
106-
| `--swagger [version]` | `-s` | `2` | specify Swagger version (currently only supports `2`) |
107-
| `--camelcase` | `-c` | `false` | convert `snake_case` properties to `camelCase` |
108-
| `--injectWarning` | `-iw` | `false` | injects an “autogenerated file” warning at the top of the generated file |
109-
| `--nowrapper` | `-nw` | `false` | disables rendering a wrapper |
102+
| Option | Alias | Default | Description |
103+
| :-------------------- | :---- | :--------------------------: | :---------------------------------------------------------------------------- |
104+
| `--wrapper` | `-w` | `declare namespace OpenAPI2` | How should this export the types? |
105+
| `--output [location]` | `-o` | (stdout) | Where should the output file be saved? |
106+
| `--swagger [version]` | `-s` | `2` | Manually specify Swagger version (by default it will use `version` in schema) |
107+
| `--camelcase` | `-c` | `false` | Convert `snake_case` properties to `camelCase` |
108+
| `--nowarning` | | `false` | Disables “autogenerated file” warning at the top of generated files |
109+
| `--nowrapper` | `-nw` | `false` | Disables rendering a wrapper |
110110

111111
### Node
112112

@@ -131,18 +131,20 @@ If your specs are in YAML, you’ll have to convert them to JS objects using a l
131131

132132
#### Node Options
133133

134-
| Name | Type | Default | Description |
135-
| :--------------- | :---------------: | :--------------------------: | :-------------------------------------------------------------------------- |
136-
| `wrapper` | `string \| false` | `declare namespace OpenAPI2` | How should this export the types? Pass false to disable rendering a wrapper |
137-
| `swagger` | `number` | `2` | Which Swagger version to use. Currently only supports `2`. |
138-
| `camelcase` | `boolean` | `false` | Convert `snake_case` properties to `camelCase` |
139-
| `propertyMapper` | `function` | `undefined` | Allows you to further manipulate how properties are parsed. See below. |
140-
134+
| Name | Type | Default | Description |
135+
| :--------------- | :---------------: | :--------------------------: | :--------------------------------------------------------------------------- |
136+
| `wrapper` | `string \| false` | `declare namespace OpenAPI2` | How should this export the types? Pass false to disable rendering a wrapper |
137+
| `swagger` | `number` | `2` | Manully specify Swagger version (by default it will use `version` in schema) |
138+
| `camelcase` | `boolean` | `false` | Convert `snake_case` properties to `camelCase` |
139+
| `propertyMapper` | `function` | `undefined` | Allows you to further manipulate how properties are parsed. See below. |
141140

142141
#### PropertyMapper
143-
In order to allow more control over how properties are parsed, and to specifically handle `x-something`-properties, the `propertyMapper` option may be specified.
144142

145-
This is a function that, if specified, is called for each property and allows you to change how swagger-to-ts handles parsing of swagger files.
143+
In order to allow more control over how properties are parsed, and to specifically handle
144+
`x-something`-properties, the `propertyMapper` option may be specified.
145+
146+
This is a function that, if specified, is called for each property and allows you to change how
147+
swagger-to-ts handles parsing of swagger files.
146148

147149
An example on how to use the `x-nullable` property to control if a property is optional:
148150

@@ -163,7 +165,6 @@ An example on how to use the `x-nullable` property to control if a property is o
163165
const output = swaggerToTS(swagger, { propertyMapper });
164166
```
165167

166-
167168
[glob]: https://www.npmjs.com/package/glob
168169
[js-yaml]: https://www.npmjs.com/package/js-yaml
169170
[namespace]: https://www.typescriptlang.org/docs/handbook/namespaces.html

bin/cli.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Options
2020
--camelcase, -c convert snake_case properties to camelCase (default: off)
2121
--swagger, -s specify Swagger version (default: 2)
2222
--nowrapper -nw disables rendering the wrapper
23-
--injectWarning -iw injects a warning at the top of the generated file (default: off)
23+
--no-warning hides the warning at the top of the generated file (default: off)
2424
`,
2525
{
2626
flags: {
@@ -54,9 +54,9 @@ Options
5454
type: 'boolean',
5555
alias: 'nw',
5656
},
57-
injectWarning: {
57+
warning: {
5858
type: 'boolean',
59-
alias: 'iw',
59+
default: true,
6060
},
6161
},
6262
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)