swagger-typescript-api 13.0.2 β 13.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +310 -369
- package/cli/constants.js +3 -3
- package/cli/execute.js +12 -12
- package/cli/index.js +16 -16
- package/cli/operations/display-help.js +25 -25
- package/cli/parse-args.js +3 -3
- package/cli/process-option.js +11 -11
- package/index.d.ts +140 -45
- package/index.js +110 -111
- package/package.json +93 -108
- package/src/code-formatter.js +6 -6
- package/src/code-gen-process.js +45 -45
- package/src/commands/generate-templates/configuration.js +2 -2
- package/src/commands/generate-templates/index.js +1 -1
- package/src/commands/generate-templates/templates-gen-process.js +21 -21
- package/src/component-type-name-resolver.js +4 -4
- package/src/configuration.js +107 -107
- package/src/constants.js +26 -26
- package/src/index.js +3 -3
- package/src/schema-components-map.js +3 -3
- package/src/schema-parser/base-schema-parsers/array.js +3 -3
- package/src/schema-parser/base-schema-parsers/complex.js +5 -5
- package/src/schema-parser/base-schema-parsers/discriminator.js +16 -13
- package/src/schema-parser/base-schema-parsers/enum.js +12 -12
- package/src/schema-parser/base-schema-parsers/object.js +8 -8
- package/src/schema-parser/base-schema-parsers/primitive.js +3 -3
- package/src/schema-parser/complex-schema-parsers/all-of.js +2 -2
- package/src/schema-parser/complex-schema-parsers/any-of.js +2 -2
- package/src/schema-parser/complex-schema-parsers/not.js +1 -1
- package/src/schema-parser/complex-schema-parsers/one-of.js +2 -2
- package/src/schema-parser/mono-schema-parser.js +1 -1
- package/src/schema-parser/schema-formatters.js +14 -14
- package/src/schema-parser/schema-parser-fabric.js +5 -5
- package/src/schema-parser/schema-parser.js +24 -24
- package/src/schema-parser/schema-utils.js +21 -21
- package/src/schema-parser/util/enum-key-resolver.js +2 -2
- package/src/schema-routes/schema-routes.js +68 -68
- package/src/schema-routes/util/specific-arg-name-resolver.js +2 -2
- package/src/schema-walker.js +7 -7
- package/src/swagger-schema-resolver.js +16 -16
- package/src/templates-worker.js +21 -18
- package/src/translators/javascript.js +7 -7
- package/src/translators/translator.js +1 -1
- package/src/type-name-formatter.js +16 -16
- package/src/util/file-system.js +13 -14
- package/src/util/id.js +2 -2
- package/src/util/internal-case.js +1 -1
- package/src/util/logger.js +27 -27
- package/src/util/name-resolver.js +5 -5
- package/src/util/object-assign.js +2 -2
- package/src/util/pascal-case.js +1 -1
- package/src/util/request.js +15 -10
- package/templates/README.md +15 -14
- package/templates/base/README.md +4 -5
- package/templates/base/http-clients/fetch-http-client.ejs +1 -1
- package/templates/base/route-name.ejs +4 -4
- package/templates/default/README.md +4 -4
- package/templates/modular/README.md +4 -4
package/README.md
CHANGED
|
@@ -1,41 +1,30 @@
|
|
|
1
|
-
# swagger-typescript-api
|
|
1
|
+
# swagger-typescript-api
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
<img
|
|
4
|
+
src="https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/swagger-typescript-api-logo.png"
|
|
5
|
+
title="swagger-typescript-api logo by js2me"
|
|
6
|
+
align="left"
|
|
7
|
+
height="180"
|
|
8
|
+
width="93"
|
|
9
|
+
/>
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
- Generate api via swagger scheme
|
|
12
|
+
- Supports OA 3.0, 2.0, JSON, yaml
|
|
13
|
+
- Generated api module use [**Fetch Api**](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) or [**Axios**](https://github.com/axios/axios) to make requests.
|
|
10
14
|
|
|
11
|
-
Generate api via swagger scheme.
|
|
12
|
-
Supports OA 3.0, 2.0, JSON, yaml
|
|
13
|
-
Generated api module use [**Fetch Api**](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) or [**Axios**](https://github.com/axios/axios) to make requests.
|
|
14
|
-
|
|
15
|
-
<br>
|
|
16
15
|
<br>
|
|
17
16
|
|
|
18
|
-
Any questions you can ask [**here**](https://github.com/acacode/swagger-typescript-api/issues) or in [**our
|
|
19
|
-
|
|
20
|
-
<br>
|
|
21
|
-
|
|
22
|
-

|
|
23
|
-
|
|
24
|
-
P.S. If you are creating the PR, please check your changes with using command `npm run prepare`
|
|
25
|
-
P.S. If you want to contribute please use the `next` branch. All PRs that has target `master` will be declined!
|
|
17
|
+
Any questions you can ask [**here**](https://github.com/acacode/swagger-typescript-api/issues) or in [**our Slack**](https://join.slack.com/t/acacode/shared_invite/enQtOTQ5ODgyODQzMzYwLWYxOGI1MzQ3Yzg1ZWI5ZTI5NzNiZjExZTE5OWI1YjQ4NjBiNTk4NWVlNjM5YmU1ZWI2ZDkyMzZkZGIxNjA5NTQ)(**#swagger-typescript-api** channel)
|
|
26
18
|
|
|
19
|
+

|
|
27
20
|
|
|
28
|
-
Thanks to [
|
|
29
|
-
<a href="https://www.jetbrains.com/?from=swaggertypescriptapi">
|
|
30
|
-
<img src="https://upload.wikimedia.org/wikipedia/commons/1/1a/JetBrains_Logo_2016.svg" alt="Jetbrains">
|
|
31
|
-
</a>
|
|
21
|
+
Thanks to [JetBrains](https://www.jetbrains.com/?from=swaggertypescriptapi) for providing a free license for their excellent Webstorm IDE.
|
|
32
22
|
|
|
23
|
+
## π Examples
|
|
33
24
|
|
|
34
|
-
|
|
25
|
+
All examples you can find [**here**](https://github.com/acacode/swagger-typescript-api/tree/master/tests)
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## π Usage
|
|
27
|
+
## π Usage
|
|
39
28
|
|
|
40
29
|
```muse
|
|
41
30
|
Usage: sta [options]
|
|
@@ -63,7 +52,7 @@ Options:
|
|
|
63
52
|
--extract-response-error extract response error type to data contract (default: false)
|
|
64
53
|
--modular generate separated files for http client, data contracts, and routes (default: false)
|
|
65
54
|
--js generate js api module with declaration file (default: false)
|
|
66
|
-
--module-name-index <number> determines which path index should be used for routes separation (example: GET:/
|
|
55
|
+
--module-name-index <number> determines which path index should be used for routes separation (example: GET:/fruits/getFruit -> index:0 -> moduleName -> fruits) (default: 0)
|
|
67
56
|
--module-name-first-tag splits routes based on the first tag (default: false)
|
|
68
57
|
--disableStrictSSL disabled strict SSL (default: false)
|
|
69
58
|
--disableProxy disabled proxy (default: false)
|
|
@@ -97,14 +86,16 @@ Commands:
|
|
|
97
86
|
-h, --help display help for command
|
|
98
87
|
```
|
|
99
88
|
|
|
100
|
-
Also you can use `npx`:
|
|
89
|
+
Also you can use `npx`:
|
|
90
|
+
|
|
101
91
|
```
|
|
102
|
-
|
|
92
|
+
npx swagger-typescript-api -p ./swagger.json -o ./src -n myApi.ts
|
|
103
93
|
```
|
|
104
94
|
|
|
105
95
|
You can use this package from nodejs:
|
|
96
|
+
|
|
106
97
|
```js
|
|
107
|
-
const { generateApi, generateTemplates } = require(
|
|
98
|
+
const { generateApi, generateTemplates } = require("swagger-typescript-api");
|
|
108
99
|
const path = require("path");
|
|
109
100
|
const fs = require("fs");
|
|
110
101
|
|
|
@@ -113,8 +104,8 @@ generateApi({
|
|
|
113
104
|
name: "MySuperbApi.ts",
|
|
114
105
|
// set to `false` to prevent the tool from writing to disk
|
|
115
106
|
output: path.resolve(process.cwd(), "./src/__generated__"),
|
|
116
|
-
url:
|
|
117
|
-
input: path.resolve(process.cwd(),
|
|
107
|
+
url: "http://api.com/swagger.json",
|
|
108
|
+
input: path.resolve(process.cwd(), "./foo/swagger.json"),
|
|
118
109
|
spec: {
|
|
119
110
|
swagger: "2.0",
|
|
120
111
|
info: {
|
|
@@ -123,7 +114,7 @@ generateApi({
|
|
|
123
114
|
},
|
|
124
115
|
// ...
|
|
125
116
|
},
|
|
126
|
-
templates: path.resolve(process.cwd(),
|
|
117
|
+
templates: path.resolve(process.cwd(), "./api-templates"),
|
|
127
118
|
httpClientType: "axios", // or "fetch"
|
|
128
119
|
defaultResponseAsSuccess: false,
|
|
129
120
|
generateClient: true,
|
|
@@ -134,7 +125,8 @@ generateApi({
|
|
|
134
125
|
extractRequestBody: false,
|
|
135
126
|
extractEnums: false,
|
|
136
127
|
unwrapResponseData: false,
|
|
137
|
-
prettier: {
|
|
128
|
+
prettier: {
|
|
129
|
+
// By default prettier config is load from your project
|
|
138
130
|
printWidth: 120,
|
|
139
131
|
tabWidth: 2,
|
|
140
132
|
trailingComma: "all",
|
|
@@ -146,10 +138,10 @@ generateApi({
|
|
|
146
138
|
enumNamesAsValues: false,
|
|
147
139
|
moduleNameFirstTag: false,
|
|
148
140
|
generateUnionEnums: false,
|
|
149
|
-
typePrefix:
|
|
150
|
-
typeSuffix:
|
|
151
|
-
enumKeyPrefix:
|
|
152
|
-
enumKeySuffix:
|
|
141
|
+
typePrefix: "",
|
|
142
|
+
typeSuffix: "",
|
|
143
|
+
enumKeyPrefix: "",
|
|
144
|
+
enumKeySuffix: "",
|
|
153
145
|
addReadonly: false,
|
|
154
146
|
sortTypes: false,
|
|
155
147
|
sortRouters: false,
|
|
@@ -157,22 +149,29 @@ generateApi({
|
|
|
157
149
|
requestBodySuffix: ["Payload", "Body", "Input"],
|
|
158
150
|
requestParamsSuffix: ["Params"],
|
|
159
151
|
responseBodySuffix: ["Data", "Result", "Output"],
|
|
160
|
-
responseErrorSuffix: [
|
|
152
|
+
responseErrorSuffix: [
|
|
153
|
+
"Error",
|
|
154
|
+
"Fail",
|
|
155
|
+
"Fails",
|
|
156
|
+
"ErrorData",
|
|
157
|
+
"HttpError",
|
|
158
|
+
"BadResponse",
|
|
159
|
+
],
|
|
161
160
|
},
|
|
162
161
|
/** allow to generate extra files based with this extra templates, see more below */
|
|
163
162
|
extraTemplates: [],
|
|
164
163
|
anotherArrayType: false,
|
|
165
164
|
fixInvalidTypeNamePrefix: "Type",
|
|
166
|
-
fixInvalidEnumKeyPrefix: "Value",
|
|
165
|
+
fixInvalidEnumKeyPrefix: "Value",
|
|
167
166
|
codeGenConstructs: (constructs) => ({
|
|
168
167
|
...constructs,
|
|
169
|
-
RecordType: (key, value) => `MyRecord<key, value
|
|
168
|
+
RecordType: (key, value) => `MyRecord<key, value>`,
|
|
170
169
|
}),
|
|
171
170
|
primitiveTypeConstructs: (constructs) => ({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
...constructs,
|
|
172
|
+
string: {
|
|
173
|
+
"date-time": "Date",
|
|
174
|
+
},
|
|
176
175
|
}),
|
|
177
176
|
hooks: {
|
|
178
177
|
onCreateComponent: (component) => {},
|
|
@@ -185,15 +184,14 @@ generateApi({
|
|
|
185
184
|
onPreParseSchema: (originalSchema, typeName, schemaType) => {},
|
|
186
185
|
onParseSchema: (originalSchema, parsedSchema) => {},
|
|
187
186
|
onPrepareConfig: (currentConfiguration) => {},
|
|
188
|
-
}
|
|
187
|
+
},
|
|
189
188
|
})
|
|
190
189
|
.then(({ files, configuration }) => {
|
|
191
190
|
files.forEach(({ content, name }) => {
|
|
192
191
|
fs.writeFile(path, content);
|
|
193
192
|
});
|
|
194
193
|
})
|
|
195
|
-
.catch(e => console.error(e))
|
|
196
|
-
|
|
194
|
+
.catch((e) => console.error(e));
|
|
197
195
|
|
|
198
196
|
generateTemplates({
|
|
199
197
|
cleanOutput: false,
|
|
@@ -202,83 +200,78 @@ generateTemplates({
|
|
|
202
200
|
modular: false,
|
|
203
201
|
silent: false,
|
|
204
202
|
rewrite: false,
|
|
205
|
-
})
|
|
206
|
-
|
|
203
|
+
});
|
|
207
204
|
```
|
|
208
205
|
|
|
206
|
+
## π options
|
|
207
|
+
|
|
208
|
+
### **`--templates`**
|
|
209
|
+
|
|
210
|
+
This option needed for cases when you don't want to use the default `swagger-typescript-api` output structure
|
|
211
|
+
You can create custom templates with extensions `.ejs` or `.eta`
|
|
209
212
|
|
|
210
|
-
|
|
211
|
-
### **`--templates`**
|
|
212
|
-
This option needed for cases when you don't want to use the default `swagger-typescript-api` output structure
|
|
213
|
-
You can create custom templates with extensions `.ejs` or `.eta`
|
|
213
|
+
Templates:
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
- `
|
|
217
|
-
- `
|
|
218
|
-
- `
|
|
219
|
-
- `
|
|
220
|
-
- `route-
|
|
221
|
-
- `route-
|
|
222
|
-
- `route-
|
|
223
|
-
- `
|
|
224
|
-
- `data-contract-jsdoc.ejs` - *(subtemplate)* generates JSDOC for data contract (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/data-contract-jsdoc.ejs))
|
|
215
|
+
- `api.ejs` - _(generates file)_ Api class module (locations: [/templates/default](https://github.com/acacode/swagger-typescript-api/tree/main/templates/default/api.ejs), [/templates/modular](https://github.com/acacode/swagger-typescript-api/tree/main/templates/modular/api.ejs))
|
|
216
|
+
- `data-contracts.ejs` - _(generates file)_ all types (data contracts) from swagger schema (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/data-contracts.ejs))
|
|
217
|
+
- `http-client.ejs` - _(generates file)_ HttpClient class module (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/http-client.ejs))
|
|
218
|
+
- `procedure-call.ejs` - _(subtemplate)_ route in Api class (locations: [/templates/default](https://github.com/acacode/swagger-typescript-api/tree/main/templates/default/procedure-call.ejs), [/templates/modular](https://github.com/acacode/swagger-typescript-api/tree/main/templates/modular/procedure-call.ejs))
|
|
219
|
+
- `route-docs.ejs` - _(generates file)_ documentation for route in Api class (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/route-docs.ejs))
|
|
220
|
+
- `route-name.ejs` - _(subtemplate)_ route name for route in Api class (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/route-name.ejs))
|
|
221
|
+
- `route-type.ejs` - _(`--route-types` option)_ _(subtemplate)_ (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/route-type.ejs))
|
|
222
|
+
- `route-types.ejs` - _(`--route-types` option)_ _(subtemplate)_ (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/route-types.ejs))
|
|
223
|
+
- `data-contract-jsdoc.ejs` - _(subtemplate)_ generates JSDOC for data contract (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/data-contract-jsdoc.ejs))
|
|
225
224
|
|
|
226
|
-
[//]: #
|
|
227
|
-
[//]: #
|
|
228
|
-
[//]: #
|
|
225
|
+
[//]: # "- `enum-data-contract.ejs` - *(subtemplate)* generates `enum` data contract (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/enum-data-contract.ejs))"
|
|
226
|
+
[//]: # "- `interface-data-contract.ejs` - *(subtemplate)* generates `interface` data contract (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/interface-data-contract.ejs))"
|
|
227
|
+
[//]: # "- `type-data-contract.ejs` - *(subtemplate)* generates `type` data contract (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/type-data-contract.ejs))"
|
|
229
228
|
|
|
229
|
+
How to use it:
|
|
230
230
|
|
|
231
|
-
How to use it:
|
|
232
231
|
1. copy `swagger-typescript-api` templates into your place in project
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
1. add `--templates PATH_TO_YOUR_TEMPLATES` option
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
NOTE:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
`
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
type `(Record<string, any> & { name: string, path: string })[]`
|
|
270
|
-
This thing allow you to generate extra ts\js files based on extra templates (one extra template for one ts\js file)
|
|
271
|
-
[Example here](https://github.com/acacode/swagger-typescript-api/tree/next/tests/spec/extra-templates)
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
## `generate-templates` command
|
|
232
|
+
- from [/templates/default](https://github.com/acacode/swagger-typescript-api/tree/main/templates/default) for single api file
|
|
233
|
+
- from [/templates/modular](https://github.com/acacode/swagger-typescript-api/tree/main/templates/modular) for multiple api files (with `--modular` option)
|
|
234
|
+
- from [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base) for base templates (templates using both in default and modular)
|
|
235
|
+
1. add `--templates PATH_TO_YOUR_TEMPLATES` option
|
|
236
|
+
1. modify [ETA](https://eta.js.org/docs/syntax) templates as you like
|
|
237
|
+
|
|
238
|
+
NOTE:
|
|
239
|
+
Eta has special directive to render template in your Eta templates - `includeFile(pathToTemplate, payload)`
|
|
240
|
+
If you want to use some default templates from this tool you can use path prefixes: `@base`, `@default`, `@modular`.
|
|
241
|
+
`@base` - [path to base templates](https://github.com/acacode/swagger-typescript-api/tree/main/templates/base)
|
|
242
|
+
`@default` - [path to single api file templates](https://github.com/acacode/swagger-typescript-api/tree/main/templates/default)
|
|
243
|
+
`@modular` - [path to multiple api files templates](https://github.com/acacode/swagger-typescript-api/tree/main/templates/modular)
|
|
244
|
+
Examples: - `includeFile("@base/data-contracts.ejs", { ...yourData, ...it })` - `includeFile("@default/api.ejs", { ...yourData, ...it })` - `includeFile("@default/procedure-call.ejs", { ...yourData, ...it })` - `includeFile("@modular/api.ejs", { ...yourData, ...it })` - `includeFile("@modular/procedure-call.ejs", { ...yourData, ...it })` - `includeFile("@base/route-docs.ejs", { ...yourData, ...it })` - `includeFile("@base/route-name.ejs", { ...yourData, ...it })` - `includeFile("@base/route-type.ejs", { ...yourData, ...it })` - `includeFile("@base/route-types.ejs", { ...yourData, ...it })`
|
|
245
|
+
|
|
246
|
+
### **`--module-name-index`**
|
|
247
|
+
|
|
248
|
+
This option should be used in cases when you have api with one global prefix like `/api`
|
|
249
|
+
Example:
|
|
250
|
+
`GET:/api/fruits/getFruits`
|
|
251
|
+
`POST:/api/fruits/addFruits`
|
|
252
|
+
`GET:/api/vegetables/addVegetable`
|
|
253
|
+
with `--module-name-index 0` Api class will have one property `api`
|
|
254
|
+
When we change it to `--module-name-index 1` then Api class have two properties `fruits` and `vegetables`
|
|
255
|
+
|
|
256
|
+
### **`--module-name-first-tag`**
|
|
257
|
+
|
|
258
|
+
This option will group your API operations based on their first tag - mirroring how the Swagger UI groups displayed operations
|
|
259
|
+
|
|
260
|
+
### `extraTemplates` (NodeJS option)
|
|
261
|
+
|
|
262
|
+
type `(Record<string, any> & { name: string, path: string })[]`
|
|
263
|
+
This thing allow you to generate extra ts\js files based on extra templates (one extra template for one ts\js file)
|
|
264
|
+
[Example here](https://github.com/acacode/swagger-typescript-api/tree/main/tests/spec/extra-templates)
|
|
265
|
+
|
|
266
|
+
## `generate-templates` command
|
|
267
|
+
|
|
275
268
|
This command allows you to generate source templates which using with option `--templates`
|
|
276
269
|
|
|
277
|
-
## Modification internal codegen structs with NodeJS API:
|
|
270
|
+
## Modification internal codegen structs with NodeJS API:
|
|
278
271
|
|
|
279
|
-
You are able to modify TypeScript internal structs using for generating output with using `generateApi` options `codeGenConstructs` and `primitiveTypeConstructs`.
|
|
272
|
+
You are able to modify TypeScript internal structs using for generating output with using `generateApi` options `codeGenConstructs` and `primitiveTypeConstructs`.
|
|
280
273
|
|
|
281
|
-
### `codeGenConstructs`
|
|
274
|
+
### `codeGenConstructs`
|
|
282
275
|
|
|
283
276
|
This option has type `(struct: CodeGenConstruct) => Partial<CodeGenConstruct>`.
|
|
284
277
|
|
|
@@ -286,281 +279,229 @@ This option has type `(struct: CodeGenConstruct) => Partial<CodeGenConstruct>`.
|
|
|
286
279
|
generateApi({
|
|
287
280
|
// ...
|
|
288
281
|
codeGenConstructs: (struct) => ({
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
},
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
282
|
+
Keyword: {
|
|
283
|
+
Number: "number",
|
|
284
|
+
String: "string",
|
|
285
|
+
Boolean: "boolean",
|
|
286
|
+
Any: "any",
|
|
287
|
+
Void: "void",
|
|
288
|
+
Unknown: "unknown",
|
|
289
|
+
Null: "null",
|
|
290
|
+
Undefined: "undefined",
|
|
291
|
+
Object: "object",
|
|
292
|
+
File: "File",
|
|
293
|
+
Date: "Date",
|
|
294
|
+
Type: "type",
|
|
295
|
+
Enum: "enum",
|
|
296
|
+
Interface: "interface",
|
|
297
|
+
Array: "Array",
|
|
298
|
+
Record: "Record",
|
|
299
|
+
Intersection: "&",
|
|
300
|
+
Union: "|",
|
|
301
|
+
},
|
|
302
|
+
CodeGenKeyword: {
|
|
303
|
+
UtilRequiredKeys: "UtilRequiredKeys",
|
|
304
|
+
},
|
|
305
|
+
/**
|
|
306
|
+
* $A[] or Array<$A>
|
|
307
|
+
*/
|
|
308
|
+
ArrayType: (content) => {
|
|
309
|
+
if (this.anotherArrayType) {
|
|
310
|
+
return `Array<${content}>`;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return `(${content})[]`;
|
|
314
|
+
},
|
|
315
|
+
/**
|
|
316
|
+
* "$A"
|
|
317
|
+
*/
|
|
318
|
+
StringValue: (content) => `"${content}"`,
|
|
319
|
+
/**
|
|
320
|
+
* $A
|
|
321
|
+
*/
|
|
322
|
+
BooleanValue: (content) => `${content}`,
|
|
323
|
+
/**
|
|
324
|
+
* $A
|
|
325
|
+
*/
|
|
326
|
+
NumberValue: (content) => `${content}`,
|
|
327
|
+
/**
|
|
328
|
+
* $A
|
|
329
|
+
*/
|
|
330
|
+
NullValue: (content) => content,
|
|
331
|
+
/**
|
|
332
|
+
* $A1 | $A2
|
|
333
|
+
*/
|
|
334
|
+
UnionType: (contents) => _.join(_.uniq(contents), ` | `),
|
|
335
|
+
/**
|
|
336
|
+
* ($A1)
|
|
337
|
+
*/
|
|
338
|
+
ExpressionGroup: (content) => (content ? `(${content})` : ""),
|
|
339
|
+
/**
|
|
340
|
+
* $A1 & $A2
|
|
341
|
+
*/
|
|
342
|
+
IntersectionType: (contents) => _.join(_.uniq(contents), ` & `),
|
|
343
|
+
/**
|
|
344
|
+
* Record<$A1, $A2>
|
|
345
|
+
*/
|
|
346
|
+
RecordType: (key, value) => `Record<${key}, ${value}>`,
|
|
347
|
+
/**
|
|
348
|
+
* readonly $key?:$value
|
|
349
|
+
*/
|
|
350
|
+
TypeField: ({ readonly, key, optional, value }) =>
|
|
351
|
+
_.compact([
|
|
352
|
+
readonly && "readonly ",
|
|
353
|
+
key,
|
|
354
|
+
optional && "?",
|
|
355
|
+
": ",
|
|
356
|
+
value,
|
|
357
|
+
]).join(""),
|
|
358
|
+
/**
|
|
359
|
+
* [key: $A1]: $A2
|
|
360
|
+
*/
|
|
361
|
+
InterfaceDynamicField: (key, value) => `[key: ${key}]: ${value}`,
|
|
362
|
+
/**
|
|
363
|
+
* $A1 = $A2
|
|
364
|
+
*/
|
|
365
|
+
EnumField: (key, value) => `${key} = ${value}`,
|
|
366
|
+
/**
|
|
367
|
+
* $A0.key = $A0.value,
|
|
368
|
+
* $A1.key = $A1.value,
|
|
369
|
+
* $AN.key = $AN.value,
|
|
370
|
+
*/
|
|
371
|
+
EnumFieldsWrapper: (contents) =>
|
|
372
|
+
_.map(contents, ({ key, value }) => ` ${key} = ${value}`).join(",\n"),
|
|
373
|
+
/**
|
|
374
|
+
* {\n $A \n}
|
|
375
|
+
*/
|
|
376
|
+
ObjectWrapper: (content) => `{\n${content}\n}`,
|
|
377
|
+
/**
|
|
378
|
+
* /** $A *\/
|
|
379
|
+
*/
|
|
380
|
+
MultilineComment: (contents, formatFn) =>
|
|
381
|
+
[
|
|
382
|
+
...(contents.length === 1
|
|
383
|
+
? [`/** ${contents[0]} */`]
|
|
384
|
+
: ["/**", ...contents.map((content) => ` * ${content}`), " */"]),
|
|
385
|
+
].map((part) => `${formatFn ? formatFn(part) : part}\n`),
|
|
386
|
+
/**
|
|
387
|
+
* $A1<...$A2.join(,)>
|
|
388
|
+
*/
|
|
389
|
+
TypeWithGeneric: (typeName, genericArgs) => {
|
|
390
|
+
return `${typeName}${
|
|
391
|
+
genericArgs.length ? `<${genericArgs.join(",")}>` : ""
|
|
392
|
+
}`;
|
|
393
|
+
},
|
|
394
|
+
}),
|
|
395
|
+
});
|
|
396
|
+
```
|
|
396
397
|
|
|
397
|
-
For example, if you need to generate output `Record<string, any>` instead of `object` you can do it with using following code:
|
|
398
|
+
For example, if you need to generate output `Record<string, any>` instead of `object` you can do it with using following code:
|
|
398
399
|
|
|
399
400
|
```ts
|
|
400
401
|
generateApi({
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
})
|
|
402
|
+
// ...
|
|
403
|
+
codeGenConstructs: (struct) => ({
|
|
404
|
+
Keyword: {
|
|
405
|
+
Object: "Record<string, any>",
|
|
406
|
+
},
|
|
407
|
+
}),
|
|
408
|
+
});
|
|
408
409
|
```
|
|
409
410
|
|
|
410
|
-
### `primitiveTypeConstructs`
|
|
411
|
+
### `primitiveTypeConstructs`
|
|
412
|
+
|
|
413
|
+
It is type mapper or translator swagger schema objects. `primitiveTypeConstructs` translates `type`/`format` schema fields to typescript structs.
|
|
414
|
+
This option has type
|
|
411
415
|
|
|
412
|
-
It is type mapper or translator swagger schema objects. `primitiveTypeConstructs` translates `type`/`format` schema fields to typescript structs.
|
|
413
|
-
This option has type
|
|
414
416
|
```ts
|
|
415
417
|
type PrimitiveTypeStructValue =
|
|
416
418
|
| string
|
|
417
|
-
| ((
|
|
419
|
+
| ((
|
|
420
|
+
schema: Record<string, any>,
|
|
421
|
+
parser: import("./src/schema-parser/schema-parser").SchemaParser,
|
|
422
|
+
) => string);
|
|
418
423
|
|
|
419
424
|
type PrimitiveTypeStruct = Record<
|
|
420
425
|
"integer" | "number" | "boolean" | "object" | "file" | "string" | "array",
|
|
421
|
-
|
|
422
|
-
|
|
426
|
+
| string
|
|
427
|
+
| ({ $default: PrimitiveTypeStructValue } & Record<
|
|
428
|
+
string,
|
|
429
|
+
PrimitiveTypeStructValue
|
|
430
|
+
>)
|
|
431
|
+
>;
|
|
423
432
|
|
|
424
|
-
declare const primitiveTypeConstructs: (
|
|
433
|
+
declare const primitiveTypeConstructs: (
|
|
434
|
+
struct: PrimitiveTypeStruct,
|
|
435
|
+
) => Partial<PrimitiveTypeStruct>;
|
|
425
436
|
|
|
426
437
|
generateApi({
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
})
|
|
438
|
+
// ...
|
|
439
|
+
primitiveTypeConstructs: (struct) => ({
|
|
440
|
+
integer: () => "number",
|
|
441
|
+
number: () => "number",
|
|
442
|
+
boolean: () => "boolean",
|
|
443
|
+
object: () => "object",
|
|
444
|
+
file: () => "File",
|
|
445
|
+
string: {
|
|
446
|
+
$default: () => "string",
|
|
447
|
+
|
|
448
|
+
/** formats */
|
|
449
|
+
binary: () => "File",
|
|
450
|
+
file: () => "File",
|
|
451
|
+
"date-time": () => "string",
|
|
452
|
+
time: () => "string",
|
|
453
|
+
date: () => "string",
|
|
454
|
+
duration: () => "string",
|
|
455
|
+
email: () => "string",
|
|
456
|
+
"idn-email": () => "string",
|
|
457
|
+
"idn-hostname": () => "string",
|
|
458
|
+
ipv4: () => "string",
|
|
459
|
+
ipv6: () => "string",
|
|
460
|
+
uuid: () => "string",
|
|
461
|
+
uri: () => "string",
|
|
462
|
+
"uri-reference": () => "string",
|
|
463
|
+
"uri-template": () => "string",
|
|
464
|
+
"json-pointer": () => "string",
|
|
465
|
+
"relative-json-pointer": () => "string",
|
|
466
|
+
regex: () => "string",
|
|
467
|
+
},
|
|
468
|
+
array: (schema, parser) => {
|
|
469
|
+
const content = parser.getInlineParseContent(schema.items);
|
|
470
|
+
return parser.safeAddNullToType(schema, `(${content})[]`);
|
|
471
|
+
},
|
|
472
|
+
}),
|
|
473
|
+
});
|
|
463
474
|
```
|
|
464
475
|
|
|
465
|
-
For example, if you need to change `"string"/"date-time"` default output as `string` to `Date` you can do it with using following code:
|
|
476
|
+
For example, if you need to change `"string"/"date-time"` default output as `string` to `Date` you can do it with using following code:
|
|
466
477
|
|
|
467
478
|
```ts
|
|
468
|
-
|
|
469
479
|
generateApi({
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
})
|
|
476
|
-
|
|
480
|
+
primitiveTypeConstructs: (struct) => ({
|
|
481
|
+
string: {
|
|
482
|
+
"date-time": "Date",
|
|
483
|
+
},
|
|
484
|
+
}),
|
|
485
|
+
});
|
|
477
486
|
```
|
|
478
487
|
|
|
479
|
-
See more about [swagger schema type/format data here](https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times)
|
|
480
|
-
|
|
481
|
-
## π Mass media
|
|
482
|
-
|
|
483
|
-
- [5 Lessons learned about swagger-typescript-api](https://christo8989.medium.com/5-lessons-learned-about-swagger-typescript-api-511240b34c1)
|
|
484
|
-
- [Why Swagger schemes are needed in frontend development ?](https://dev.to/js2me/why-swagger-schemes-are-needed-in-frontend-development-2cb4)
|
|
485
|
-
- [Migration en douceur vers TypeScript (French)](https://www.premieroctet.com/blog/migration-typescript/)
|
|
486
|
-
- [swagger-typescript-api usage (Japanese)](https://zenn.dev/watahaya/articles/2f4a716c47903b)
|
|
487
|
-
|
|
488
|
-
##
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
499
|
-
<!-- prettier-ignore-start -->
|
|
500
|
-
<!-- markdownlint-disable -->
|
|
501
|
-
<table>
|
|
502
|
-
<tbody>
|
|
503
|
-
<tr>
|
|
504
|
-
<td align="center"><a href="https://github.com/js2me"><img src="https://avatars1.githubusercontent.com/u/16340911?v=4?s=100" width="100px;" alt="Sergey S. Volkov"/><br /><sub><b>Sergey S. Volkov</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=js2me" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/commits?author=js2me" title="Documentation">π</a> <a href="#design-js2me" title="Design">π¨</a> <a href="#example-js2me" title="Examples">π‘</a> <a href="#maintenance-js2me" title="Maintenance">π§</a> <a href="#ideas-js2me" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Ajs2me" title="Bug reports">π</a></td>
|
|
505
|
-
<td align="center"><a href="https://github.com/andrefilimono"><img src="https://avatars0.githubusercontent.com/u/7794526?v=4?s=100" width="100px;" alt="Filimonov Andrey"/><br /><sub><b>Filimonov Andrey</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=andrefilimono" title="Code">π»</a> <a href="#ideas-andrefilimono" title="Ideas, Planning, & Feedback">π€</a> <a href="#design-andrefilimono" title="Design">π¨</a></td>
|
|
506
|
-
<td align="center"><a href="https://github.com/Fl0pZz"><img src="https://avatars2.githubusercontent.com/u/9510124?v=4?s=100" width="100px;" alt="Rafael Fakhreev"/><br /><sub><b>Rafael Fakhreev</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=Fl0pZz" title="Code">π»</a> <a href="#ideas-Fl0pZz" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
507
|
-
<td align="center"><a href="https://azzola.dev"><img src="https://avatars3.githubusercontent.com/u/1297597?v=4?s=100" width="100px;" alt="Lucas Azzola"/><br /><sub><b>Lucas Azzola</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=azz" title="Code">π»</a> <a href="#ideas-azz" title="Ideas, Planning, & Feedback">π€</a> <a href="#design-azz" title="Design">π¨</a></td>
|
|
508
|
-
<td align="center"><a href="https://github.com/JennieJi"><img src="https://avatars3.githubusercontent.com/u/1913045?v=4?s=100" width="100px;" alt="Jennie"/><br /><sub><b>Jennie</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=JennieJi" title="Code">π»</a> <a href="#ideas-JennieJi" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
509
|
-
<td align="center"><a href="https://github.com/jomarquez21"><img src="https://avatars1.githubusercontent.com/u/16705169?v=4?s=100" width="100px;" alt="Jose Enrique Marquez"/><br /><sub><b>Jose Enrique Marquez</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=jomarquez21" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Ajomarquez21" title="Bug reports">π</a></td>
|
|
510
|
-
<td align="center"><a href="https://glassechidna.com.au"><img src="https://avatars1.githubusercontent.com/u/482276?v=4?s=100" width="100px;" alt="Benjamin Dobell"/><br /><sub><b>Benjamin Dobell</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=Benjamin-Dobell" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3ABenjamin-Dobell" title="Bug reports">π</a></td>
|
|
511
|
-
</tr>
|
|
512
|
-
<tr>
|
|
513
|
-
<td align="center"><a href="http://fixate.it"><img src="https://avatars0.githubusercontent.com/u/1510520?v=4?s=100" width="100px;" alt="Larry Botha"/><br /><sub><b>Larry Botha</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=larrybotha" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Alarrybotha" title="Bug reports">π</a></td>
|
|
514
|
-
<td align="center"><a href="https://github.com/nikalun"><img src="https://avatars3.githubusercontent.com/u/13102962?v=4?s=100" width="100px;" alt="Nikolay Lukinykh"/><br /><sub><b>Nikolay Lukinykh</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=nikalun" title="Code">π»</a> <a href="#ideas-nikalun" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Anikalun" title="Bug reports">π</a></td>
|
|
515
|
-
<td align="center"><a href="https://github.com/Mvbraathen"><img src="https://avatars0.githubusercontent.com/u/16756739?v=4?s=100" width="100px;" alt="Marius BrΓ₯then"/><br /><sub><b>Marius BrΓ₯then</b></sub></a><br /><a href="#security-Mvbraathen" title="Security">π‘οΈ</a></td>
|
|
516
|
-
<td align="center"><a href="https://github.com/xesjkeee"><img src="https://avatars2.githubusercontent.com/u/17751886?v=4?s=100" width="100px;" alt="Evgeny Vlasov"/><br /><sub><b>Evgeny Vlasov</b></sub></a><br /><a href="#ideas-xesjkeee" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
517
|
-
<td align="center"><a href="https://github.com/kel666"><img src="https://avatars1.githubusercontent.com/u/2040661?v=4?s=100" width="100px;" alt="Fabio"/><br /><sub><b>Fabio</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Akel666" title="Bug reports">π</a> <a href="https://github.com/acacode/swagger-typescript-api/commits?author=kel666" title="Code">π»</a></td>
|
|
518
|
-
<td align="center"><a href="https://github.com/Fabiencdp"><img src="https://avatars.githubusercontent.com/u/6182473?v=4?s=100" width="100px;" alt="Fabien"/><br /><sub><b>Fabien</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3AFabiencdp" title="Bug reports">π</a></td>
|
|
519
|
-
<td align="center"><a href="https://about.me/julienrousseau"><img src="https://avatars.githubusercontent.com/u/3296671?v=4?s=100" width="100px;" alt="Rousseau Julien"/><br /><sub><b>Rousseau Julien</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3ARoXuS" title="Bug reports">π</a></td>
|
|
520
|
-
</tr>
|
|
521
|
-
<tr>
|
|
522
|
-
<td align="center"><a href="http://sebastianarias.dev"><img src="https://avatars.githubusercontent.com/u/9751266?v=4?s=100" width="100px;" alt="SebastiΓ‘n Arias"/><br /><sub><b>SebastiΓ‘n Arias</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3ALarox" title="Bug reports">π</a></td>
|
|
523
|
-
<td align="center"><a href="https://github.com/Styn"><img src="https://avatars.githubusercontent.com/u/6705137?v=4?s=100" width="100px;" alt="Stijn Lammens"/><br /><sub><b>Stijn Lammens</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3AStyn" title="Bug reports">π</a> <a href="https://github.com/acacode/swagger-typescript-api/commits?author=Styn" title="Code">π»</a></td>
|
|
524
|
-
<td align="center"><a href="http://emilecantin.com"><img src="https://avatars.githubusercontent.com/u/885486?v=4?s=100" width="100px;" alt="Emile Cantin"/><br /><sub><b>Emile Cantin</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Aemilecantin" title="Bug reports">π</a> <a href="https://github.com/acacode/swagger-typescript-api/commits?author=emilecantin" title="Code">π»</a></td>
|
|
525
|
-
<td align="center"><a href="https://github.com/armsnyder"><img src="https://avatars.githubusercontent.com/u/9969202?v=4?s=100" width="100px;" alt="Adam Snyder"/><br /><sub><b>Adam Snyder</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=armsnyder" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Aarmsnyder" title="Bug reports">π</a></td>
|
|
526
|
-
<td align="center"><a href="https://github.com/jnpoyser"><img src="https://avatars.githubusercontent.com/u/7920428?v=4?s=100" width="100px;" alt="James Poyser"/><br /><sub><b>James Poyser</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=jnpoyser" title="Code">π»</a> <a href="#ideas-jnpoyser" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
527
|
-
<td align="center"><a href="http://ru.linkedin.com/in/lisikhin"><img src="https://avatars.githubusercontent.com/u/475367?v=4?s=100" width="100px;" alt="Alexey"/><br /><sub><b>Alexey</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3ANihisil" title="Bug reports">π</a></td>
|
|
528
|
-
<td align="center"><a href="http://imaniu.com"><img src="https://avatars.githubusercontent.com/u/50100681?v=4?s=100" width="100px;" alt="ζ±ιΊ»ε¦"/><br /><sub><b>ζ±ιΊ»ε¦</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=jiangmaniu" title="Code">π»</a></td>
|
|
529
|
-
</tr>
|
|
530
|
-
<tr>
|
|
531
|
-
<td align="center"><a href="https://kspr.dev"><img src="https://avatars.githubusercontent.com/u/5294519?v=4?s=100" width="100px;" alt="Kasper Moskwiak"/><br /><sub><b>Kasper Moskwiak</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=kmoskwiak" title="Code">π»</a> <a href="#ideas-kmoskwiak" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
532
|
-
<td align="center"><a href="https://github.com/baggoedw"><img src="https://avatars.githubusercontent.com/u/92381702?v=4?s=100" width="100px;" alt="baggoedw"/><br /><sub><b>baggoedw</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=baggoedw" title="Code">π»</a></td>
|
|
533
|
-
<td align="center"><a href="https://marcusdunn.github.io"><img src="https://avatars.githubusercontent.com/u/51931484?v=4?s=100" width="100px;" alt="Marcus Dunn"/><br /><sub><b>Marcus Dunn</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=MarcusDunn" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3AMarcusDunn" title="Bug reports">π</a></td>
|
|
534
|
-
<td align="center"><a href="https://www.danielplayfaircal.com/"><img src="https://avatars.githubusercontent.com/u/1217649?v=4?s=100" width="100px;" alt="Daniel Playfair Cal"/><br /><sub><b>Daniel Playfair Cal</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=hedgepigdaniel" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Ahedgepigdaniel" title="Bug reports">π</a></td>
|
|
535
|
-
<td align="center"><a href="https://www.linkedin.com/in/patrick-shaw/"><img src="https://avatars.githubusercontent.com/u/5153619?v=4?s=100" width="100px;" alt="Patrick Shaw"/><br /><sub><b>Patrick Shaw</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/pulls?q=is%3Apr+reviewed-by%3APatrickShaw" title="Reviewed Pull Requests">π</a></td>
|
|
536
|
-
<td align="center"><a href="http://brook.dev"><img src="https://avatars.githubusercontent.com/u/9323190?v=4?s=100" width="100px;" alt="Brook Jordan"/><br /><sub><b>Brook Jordan</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=brookjordan" title="Code">π»</a></td>
|
|
537
|
-
<td align="center"><a href="https://github.com/RoCat"><img src="https://avatars.githubusercontent.com/u/3562317?v=4?s=100" width="100px;" alt="RoCat"/><br /><sub><b>RoCat</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=RoCat" title="Code">π»</a> <a href="#ideas-RoCat" title="Ideas, Planning, & Feedback">π€</a> <a href="#design-RoCat" title="Design">π¨</a></td>
|
|
538
|
-
</tr>
|
|
539
|
-
<tr>
|
|
540
|
-
<td align="center"><a href="https://github.com/ApacheEx"><img src="https://avatars.githubusercontent.com/u/1918108?v=4?s=100" width="100px;" alt="Oleg Kuzava"/><br /><sub><b>Oleg Kuzava</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=ApacheEx" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3AApacheEx" title="Bug reports">π</a></td>
|
|
541
|
-
<td align="center"><a href="http://nikz.se"><img src="https://avatars.githubusercontent.com/u/7352072?v=4?s=100" width="100px;" alt="Niklas Frank"/><br /><sub><b>Niklas Frank</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=nksfrank" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3Anksfrank" title="Bug reports">π</a></td>
|
|
542
|
-
<td align="center"><a href="https://quentinbrunet.com"><img src="https://avatars.githubusercontent.com/u/20137632?v=4?s=100" width="100px;" alt="Quentin Brunet"/><br /><sub><b>Quentin Brunet</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=qboot" title="Code">π»</a></td>
|
|
543
|
-
<td align="center"><a href="https://github.com/Soarc"><img src="https://avatars.githubusercontent.com/u/3385495?v=4?s=100" width="100px;" alt="Gor Rustamyan"/><br /><sub><b>Gor Rustamyan</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=Soarc" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3ASoarc" title="Bug reports">π</a></td>
|
|
544
|
-
<td align="center"><a href="https://github.com/JochenDiekenbrock"><img src="https://avatars.githubusercontent.com/u/1625222?v=4?s=100" width="100px;" alt="Jochen Diekenbrock"/><br /><sub><b>Jochen Diekenbrock</b></sub></a><br /><a href="https://github.com/acacode/swagger-typescript-api/commits?author=JochenDiekenbrock" title="Code">π»</a> <a href="https://github.com/acacode/swagger-typescript-api/issues?q=author%3AJochenDiekenbrock" title="Bug reports">π</a></td>
|
|
545
|
-
</tr>
|
|
546
|
-
</tbody>
|
|
547
|
-
</table>
|
|
548
|
-
|
|
549
|
-
<!-- markdownlint-restore -->
|
|
550
|
-
<!-- prettier-ignore-end -->
|
|
551
|
-
|
|
552
|
-
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
553
|
-
|
|
554
|
-
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
|
555
|
-
|
|
556
|
-
## π How it looks
|
|
557
|
-
|
|
558
|
-

|
|
559
|
-
|
|
560
|
-

|
|
561
|
-
|
|
562
|
-

|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
## π License
|
|
488
|
+
See more about [swagger schema type/format data here](https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times)
|
|
489
|
+
|
|
490
|
+
## π Mass media
|
|
491
|
+
|
|
492
|
+
- [5 Lessons learned about swagger-typescript-api](https://christo8989.medium.com/5-lessons-learned-about-swagger-typescript-api-511240b34c1)
|
|
493
|
+
- [Why Swagger schemes are needed in frontend development ?](https://dev.to/js2me/why-swagger-schemes-are-needed-in-frontend-development-2cb4)
|
|
494
|
+
- [Migration en douceur vers TypeScript (French)](https://www.premieroctet.com/blog/migration-typescript/)
|
|
495
|
+
- [swagger-typescript-api usage (Japanese)](https://zenn.dev/watahaya/articles/2f4a716c47903b)
|
|
496
|
+
|
|
497
|
+
## π How it looks
|
|
498
|
+
|
|
499
|
+

|
|
500
|
+
|
|
501
|
+

|
|
502
|
+
|
|
503
|
+

|
|
504
|
+
|
|
505
|
+
## π License
|
|
506
|
+
|
|
566
507
|
Licensed under the [MIT License](https://github.com/acacode/swagger-typescript-api/blob/master/LICENSE).
|