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: README.md
+41-8Lines changed: 41 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,13 +19,6 @@
19
19
- Supports tsc and @babel/plugin-transform-typescript
20
20
21
21
22
-
## Babel support:
23
-
If you use enums inside your models / definitions then those enums are by default inside a namespace with the same name
24
-
as your model. This is called declaration merging. However, the [@babel/plugin-transform-typescript](https://babeljs.io/docs/en/babel-plugin-transform-typescript)
25
-
does not support these namespaces, so if you are using babel in your project please use the `--useUnionTypes` flag
26
-
to generate union types instead of traditional enums. More info can be found here: [Enums vs. Union Types](#enums-vs-union-types---useuniontypes).
27
-
28
-
29
22
## Install
30
23
31
24
```
@@ -44,7 +37,7 @@ $ openapi --help
44
37
-V, --version output the version number
45
38
-i, --input <value> OpenAPI specification, can be a path, url or string content (required)
--exportCore <value> Write core files to disk (default: true)
@@ -354,3 +347,43 @@ HTTP client, etc. I've compiled a list with the results per area and how they
354
347
compare against the openapi-typescript-codegen.
355
348
356
349
[Click here to see the comparison](https://htmlpreview.github.io/?https://github.com/ferdikoomen/openapi-typescript-codegen/blob/master/samples/index.html)
350
+
351
+
352
+
FAQ
353
+
===
354
+
355
+
### Babel support
356
+
If you use enums inside your models / definitions then those enums are by default inside a namespace with the same name
357
+
as your model. This is called declaration merging. However, the [@babel/plugin-transform-typescript](https://babeljs.io/docs/en/babel-plugin-transform-typescript)
358
+
does not support these namespaces, so if you are using babel in your project please use the `--useUnionTypes` flag
359
+
to generate union types instead of traditional enums. More info can be found here: [Enums vs. Union Types](#enums-vs-union-types---useuniontypes).
360
+
361
+
**Note:** If you are using Babel 7 and Typescript 3.8 (or higher) then you should enable the `onlyRemoveTypeImports` to
362
+
ignore any 'type only' imports, see https://babeljs.io/docs/en/babel-preset-typescript#onlyremovetypeimports for more info
363
+
364
+
```javascript
365
+
module.exports= {
366
+
presets: [
367
+
['@babel/preset-typescript', {
368
+
onlyRemoveTypeImports:true,
369
+
}],
370
+
],
371
+
};
372
+
```
373
+
374
+
375
+
### Node.js support
376
+
By default, this library will generate a client that is compatible with the (browser based) [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API),
377
+
however this client will not work inside the Node.js environment. If you want to generate a Node.js compatible client then
378
+
you can specify `--client node` in the openapi call:
0 commit comments