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
+11-21Lines changed: 11 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@
10
10
11
11
## Why?
12
12
- Frontend ❤️ OpenAPI, but we do not want to use JAVA codegen in our builds
13
-
- Quick, lightweight, robust and framework agnostic
13
+
- Quick, lightweight, robust and framework agnostic 🚀
14
14
- Supports generation of TypeScript clients
15
15
- Supports generations of fetch and XHR http clients
16
16
- Supports OpenAPI specification v2.0 and v3.0
@@ -20,12 +20,10 @@
20
20
21
21
22
22
## Babel support:
23
-
- If you use enums inside your models / definitions then those enums are by default
24
-
inside a namespace with the same name as your model. This is called declaration
25
-
merging. However, the @babel/plugin-transform-typescript does not support these
26
-
namespaces, so if you are using babel in your project please use the `--useUnionTypes`
27
-
flag to generate union types instead of traditional enums. More info can be found
28
-
here: [Enums vs. Union Types](#enums-vs-union-types).
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).
// Or by providing the content of the spec directly 🚀
99
90
OpenAPI.generate({
100
-
input: spec,
91
+
input:require('./spec.json'),
101
92
output:'./dist'
102
93
});
103
94
```
@@ -142,10 +133,9 @@ createUser({
142
133
The OpenAPI spec allows you to define [enums](https://swagger.io/docs/specification/data-models/enums/) inside the
143
134
data model. By default, we convert these enums definitions to [TypeScript enums](https://www.typescriptlang.org/docs/handbook/enums.html).
144
135
However, these enums are merged inside the namespace of the model, this is unsupported by Babel, [see docs](https://babeljs.io/docs/en/babel-plugin-transform-typescript#impartial-namespace-support).
145
-
146
-
Because we also want to support projects that use Babel [@babel/plugin-transform-typescript](https://babeljs.io/docs/en/babel-plugin-transform-typescript), we offer the flag `--useOptions` to generate
147
-
[union types](https://www.typescriptlang.org/docs/handbook/unions-and-intersections.html#union-types) instead of
148
-
the traditional enums. The difference can be seen below:
136
+
Because we also want to support projects that use Babel [@babel/plugin-transform-typescript](https://babeljs.io/docs/en/babel-plugin-transform-typescript),
137
+
we offer the flag `--useOptions` to generate [union types](https://www.typescriptlang.org/docs/handbook/unions-and-intersections.html#union-types)
138
+
instead of the traditional enums. The difference can be seen below:
0 commit comments