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.
Files changed (58) hide show
  1. package/README.md +310 -369
  2. package/cli/constants.js +3 -3
  3. package/cli/execute.js +12 -12
  4. package/cli/index.js +16 -16
  5. package/cli/operations/display-help.js +25 -25
  6. package/cli/parse-args.js +3 -3
  7. package/cli/process-option.js +11 -11
  8. package/index.d.ts +140 -45
  9. package/index.js +110 -111
  10. package/package.json +93 -108
  11. package/src/code-formatter.js +6 -6
  12. package/src/code-gen-process.js +45 -45
  13. package/src/commands/generate-templates/configuration.js +2 -2
  14. package/src/commands/generate-templates/index.js +1 -1
  15. package/src/commands/generate-templates/templates-gen-process.js +21 -21
  16. package/src/component-type-name-resolver.js +4 -4
  17. package/src/configuration.js +107 -107
  18. package/src/constants.js +26 -26
  19. package/src/index.js +3 -3
  20. package/src/schema-components-map.js +3 -3
  21. package/src/schema-parser/base-schema-parsers/array.js +3 -3
  22. package/src/schema-parser/base-schema-parsers/complex.js +5 -5
  23. package/src/schema-parser/base-schema-parsers/discriminator.js +16 -13
  24. package/src/schema-parser/base-schema-parsers/enum.js +12 -12
  25. package/src/schema-parser/base-schema-parsers/object.js +8 -8
  26. package/src/schema-parser/base-schema-parsers/primitive.js +3 -3
  27. package/src/schema-parser/complex-schema-parsers/all-of.js +2 -2
  28. package/src/schema-parser/complex-schema-parsers/any-of.js +2 -2
  29. package/src/schema-parser/complex-schema-parsers/not.js +1 -1
  30. package/src/schema-parser/complex-schema-parsers/one-of.js +2 -2
  31. package/src/schema-parser/mono-schema-parser.js +1 -1
  32. package/src/schema-parser/schema-formatters.js +14 -14
  33. package/src/schema-parser/schema-parser-fabric.js +5 -5
  34. package/src/schema-parser/schema-parser.js +24 -24
  35. package/src/schema-parser/schema-utils.js +21 -21
  36. package/src/schema-parser/util/enum-key-resolver.js +2 -2
  37. package/src/schema-routes/schema-routes.js +68 -68
  38. package/src/schema-routes/util/specific-arg-name-resolver.js +2 -2
  39. package/src/schema-walker.js +7 -7
  40. package/src/swagger-schema-resolver.js +16 -16
  41. package/src/templates-worker.js +21 -18
  42. package/src/translators/javascript.js +7 -7
  43. package/src/translators/translator.js +1 -1
  44. package/src/type-name-formatter.js +16 -16
  45. package/src/util/file-system.js +13 -14
  46. package/src/util/id.js +2 -2
  47. package/src/util/internal-case.js +1 -1
  48. package/src/util/logger.js +27 -27
  49. package/src/util/name-resolver.js +5 -5
  50. package/src/util/object-assign.js +2 -2
  51. package/src/util/pascal-case.js +1 -1
  52. package/src/util/request.js +15 -10
  53. package/templates/README.md +15 -14
  54. package/templates/base/README.md +4 -5
  55. package/templates/base/http-clients/fetch-http-client.ejs +1 -1
  56. package/templates/base/route-name.ejs +4 -4
  57. package/templates/default/README.md +4 -4
  58. 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
- [![NPM badge](https://img.shields.io/npm/v/swagger-typescript-api.svg)](https://www.npmjs.com/package/swagger-typescript-api)
4
- [![CI](https://github.com/acacode/swagger-typescript-api/actions/workflows/main.yml/badge.svg?branch=next)](https://github.com/acacode/swagger-typescript-api/actions/workflows/main.yml) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
5
- [![All Contributors](https://img.shields.io/badge/all_contributors-33-orange.svg)](#contributors)
6
- <!-- ALL-CONTRIBUTORS-BADGE:END -->
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
- <img src="https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/swagger-typescript-api-logo.png" align="left"
9
- title="swagger-typescript-api logo by js2me" width="93" height="180">
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 slack**](https://join.slack.com/t/acacode/shared_invite/enQtOTQ5ODgyODQzMzYwLWYxOGI1MzQ3Yzg1ZWI5ZTI5NzNiZjExZTE5OWI1YjQ4NjBiNTk4NWVlNjM5YmU1ZWI2ZDkyMzZkZGIxNjA5NTQ)(**#swagger-typescript-api** channel)
19
-
20
- <br>
21
-
22
- ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/components-converter-example.jpg)
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
+ ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/components-converter-example.jpg)
27
20
 
28
- Thanks to [Jetbrains](https://www.jetbrains.com/?from=swaggertypescriptapi) for providing a free license for their excellent Webstorm IDE.
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
- ## πŸ‘€ Examples
25
+ All examples you can find [**here**](https://github.com/acacode/swagger-typescript-api/tree/master/tests)
35
26
 
36
- All examples you can find [**here**](https://github.com/acacode/swagger-typescript-api/tree/master/tests)
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:/fruites/getFruit -> index:0 -> moduleName -> fruites) (default: 0)
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
- npx swagger-typescript-api -p ./swagger.json -o ./src -n myApi.ts
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('swagger-typescript-api');
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: 'http://api.com/swagger.json',
117
- input: path.resolve(process.cwd(), './foo/swagger.json'),
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(), './api-templates'),
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: { // By default prettier config is load from your project
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: ["Error", "Fail", "Fails", "ErrorData", "HttpError", "BadResponse"],
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
- ...constructs,
173
- string: {
174
- 'date-time': 'Date'
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
- ## πŸ’Ž options
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
- Templates:
216
- - `api.ejs` - *(generates file)* Api class module (locations: [/templates/default](https://github.com/acacode/swagger-typescript-api/tree/next/templates/default/api.ejs), [/templates/modular](https://github.com/acacode/swagger-typescript-api/tree/next/templates/modular/api.ejs))
217
- - `data-contracts.ejs` - *(generates file)* all types (data contracts) from swagger schema (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/data-contracts.ejs))
218
- - `http-client.ejs` - *(generates file)* HttpClient class module (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/http-client.ejs))
219
- - `procedure-call.ejs` - *(subtemplate)* route in Api class (locations: [/templates/default](https://github.com/acacode/swagger-typescript-api/tree/next/templates/default/procedure-call.ejs), [/templates/modular](https://github.com/acacode/swagger-typescript-api/tree/next/templates/modular/procedure-call.ejs))
220
- - `route-docs.ejs` - *(generates file)* documentation for route in Api class (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/route-docs.ejs))
221
- - `route-name.ejs` - *(subtemplate)* route name for route in Api class (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/route-name.ejs))
222
- - `route-type.ejs` - *(`--route-types` option)* *(subtemplate)* (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/route-type.ejs))
223
- - `route-types.ejs` - *(`--route-types` option)* *(subtemplate)* (locations: [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/route-types.ejs))
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
- [//]: # (- `enum-data-contract.ejs` - *&#40;subtemplate&#41;* generates `enum` data contract &#40;locations: [/templates/base]&#40;https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/enum-data-contract.ejs&#41;&#41;)
227
- [//]: # (- `interface-data-contract.ejs` - *&#40;subtemplate&#41;* generates `interface` data contract &#40;locations: [/templates/base]&#40;https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/interface-data-contract.ejs&#41;&#41;)
228
- [//]: # (- `type-data-contract.ejs` - *&#40;subtemplate&#41;* generates `type` data contract &#40;locations: [/templates/base]&#40;https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/type-data-contract.ejs&#41;&#41;)
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
- - from [/templates/default](https://github.com/acacode/swagger-typescript-api/tree/next/templates/default) for single api file
234
- - from [/templates/modular](https://github.com/acacode/swagger-typescript-api/tree/next/templates/modular) for multiple api files (with `--modular` option)
235
- - from [/templates/base](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base) for base templates (templates using both in default and modular)
236
- 1. add `--templates PATH_TO_YOUR_TEMPLATES` option
237
- 2. modify [ETA](https://eta.js.org/docs/syntax) templates as you like
238
-
239
- NOTE:
240
- Eta has special directive to render template in your Eta templates - `includeFile(pathToTemplate, payload)`
241
- If you want to use some default templates from this tool you can use path prefixes: `@base`, `@default`, `@modular`.
242
- `@base` - [path to base templates](https://github.com/acacode/swagger-typescript-api/tree/next/templates/base)
243
- `@default` - [path to single api file templates](https://github.com/acacode/swagger-typescript-api/tree/next/templates/default)
244
- `@modular` - [path to multiple api files templates](https://github.com/acacode/swagger-typescript-api/tree/next/templates/modular)
245
- Examples:
246
- - `includeFile("@base/data-contracts.ejs", { ...yourData, ...it })`
247
- - `includeFile("@default/api.ejs", { ...yourData, ...it })`
248
- - `includeFile("@default/procedure-call.ejs", { ...yourData, ...it })`
249
- - `includeFile("@modular/api.ejs", { ...yourData, ...it })`
250
- - `includeFile("@modular/procedure-call.ejs", { ...yourData, ...it })`
251
- - `includeFile("@base/route-docs.ejs", { ...yourData, ...it })`
252
- - `includeFile("@base/route-name.ejs", { ...yourData, ...it })`
253
- - `includeFile("@base/route-type.ejs", { ...yourData, ...it })`
254
- - `includeFile("@base/route-types.ejs", { ...yourData, ...it })`
255
-
256
- ### **`--module-name-index`**
257
- This option should be used in cases when you have api with one global prefix like `/api`
258
- Example:
259
- `GET:/api/fruits/getFruits`
260
- `POST:/api/fruits/addFruits`
261
- `GET:/api/vegetables/addVegetable`
262
- with `--module-name-index 0` Api class will have one property `api`
263
- When we change it to `--module-name-index 1` then Api class have two properties `fruits` and `vegetables`
264
-
265
- ### **`--module-name-first-tag`**
266
- This option will group your API operations based on their first tag - mirroring how the Swagger UI groups displayed operations
267
-
268
- ### `extraTemplates` (NodeJS option)
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
- Keyword: {
290
- Number: "number",
291
- String: "string",
292
- Boolean: "boolean",
293
- Any: "any",
294
- Void: "void",
295
- Unknown: "unknown",
296
- Null: "null",
297
- Undefined: "undefined",
298
- Object: "object",
299
- File: "File",
300
- Date: "Date",
301
- Type: "type",
302
- Enum: "enum",
303
- Interface: "interface",
304
- Array: "Array",
305
- Record: "Record",
306
- Intersection: "&",
307
- Union: "|",
308
- },
309
- CodeGenKeyword: {
310
- UtilRequiredKeys: "UtilRequiredKeys",
311
- },
312
- /**
313
- * $A[] or Array<$A>
314
- */
315
- ArrayType: (content) => {
316
- if (this.anotherArrayType) {
317
- return `Array<${content}>`;
318
- }
319
-
320
- return `(${content})[]`;
321
- },
322
- /**
323
- * "$A"
324
- */
325
- StringValue: (content) => `"${content}"`,
326
- /**
327
- * $A
328
- */
329
- BooleanValue: (content) => `${content}`,
330
- /**
331
- * $A
332
- */
333
- NumberValue: (content) => `${content}`,
334
- /**
335
- * $A
336
- */
337
- NullValue: (content) => content,
338
- /**
339
- * $A1 | $A2
340
- */
341
- UnionType: (contents) => _.join(_.uniq(contents), ` | `),
342
- /**
343
- * ($A1)
344
- */
345
- ExpressionGroup: (content) => (content ? `(${content})` : ""),
346
- /**
347
- * $A1 & $A2
348
- */
349
- IntersectionType: (contents) => _.join(_.uniq(contents), ` & `),
350
- /**
351
- * Record<$A1, $A2>
352
- */
353
- RecordType: (key, value) => `Record<${key}, ${value}>`,
354
- /**
355
- * readonly $key?:$value
356
- */
357
- TypeField: ({ readonly, key, optional, value }) =>
358
- _.compact([readonly && "readonly ", key, optional && "?", ": ", value]).join(""),
359
- /**
360
- * [key: $A1]: $A2
361
- */
362
- InterfaceDynamicField: (key, value) => `[key: ${key}]: ${value}`,
363
- /**
364
- * $A1 = $A2
365
- */
366
- EnumField: (key, value) => `${key} = ${value}`,
367
- /**
368
- * $A0.key = $A0.value,
369
- * $A1.key = $A1.value,
370
- * $AN.key = $AN.value,
371
- */
372
- EnumFieldsWrapper: (contents) =>
373
- _.map(contents, ({ key, value }) => ` ${key} = ${value}`).join(",\n"),
374
- /**
375
- * {\n $A \n}
376
- */
377
- ObjectWrapper: (content) => `{\n${content}\n}`,
378
- /**
379
- * /** $A *\/
380
- */
381
- MultilineComment: (contents, formatFn) =>
382
- [
383
- ...(contents.length === 1
384
- ? [`/** ${contents[0]} */`]
385
- : ["/**", ...contents.map((content) => ` * ${content}`), " */"]),
386
- ].map((part) => `${formatFn ? formatFn(part) : part}\n`),
387
- /**
388
- * $A1<...$A2.join(,)>
389
- */
390
- TypeWithGeneric: (typeName, genericArgs) => {
391
- return `${typeName}${genericArgs.length ? `<${genericArgs.join(",")}>` : ""}`;
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
- codeGenConstructs: (struct) => ({
403
- Keyword: {
404
- Object: "Record<string, any>",
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
- | ((schema: Record<string, any>, parser: import("./src/schema-parser/schema-parser").SchemaParser) => string);
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
- string | ({ $default: PrimitiveTypeStructValue } & Record<string, PrimitiveTypeStructValue>)
422
- >
426
+ | string
427
+ | ({ $default: PrimitiveTypeStructValue } & Record<
428
+ string,
429
+ PrimitiveTypeStructValue
430
+ >)
431
+ >;
423
432
 
424
- declare const primitiveTypeConstructs: (struct: PrimitiveTypeStruct) => Partial<PrimitiveTypeStruct>
433
+ declare const primitiveTypeConstructs: (
434
+ struct: PrimitiveTypeStruct,
435
+ ) => Partial<PrimitiveTypeStruct>;
425
436
 
426
437
  generateApi({
427
- // ...
428
- primitiveTypeConstructs: (struct) => ({
429
- integer: () => "number",
430
- number: () => "number",
431
- boolean: () => "boolean",
432
- object: () => "object",
433
- file: () => "File",
434
- string: {
435
- $default: () => "string",
436
-
437
- /** formats */
438
- binary: () => "File",
439
- file: () => "File",
440
- "date-time": () => "string",
441
- time: () => "string",
442
- date: () => "string",
443
- duration: () => "string",
444
- email: () => "string",
445
- "idn-email": () => "string",
446
- "idn-hostname": () => "string",
447
- ipv4: () => "string",
448
- ipv6: () => "string",
449
- uuid: () => "string",
450
- uri: () => "string",
451
- "uri-reference": () => "string",
452
- "uri-template": () => "string",
453
- "json-pointer": () => "string",
454
- "relative-json-pointer": () => "string",
455
- regex: () => "string",
456
- },
457
- array: (schema, parser) => {
458
- const content = parser.getInlineParseContent(schema.items);
459
- return parser.safeAddNullToType(schema, `(${content})[]`);
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
- primitiveTypeConstructs: (struct) => ({
471
- string: {
472
- "date-time": "Date",
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
- ## πŸ› οΈ Contribution
489
-
490
- ❗❗❗ Please use the `next` branch :)
491
-
492
- If you need to check your changes at schemas in `tests` folder before create a PR just run command `npm run test-all`
493
-
494
- ## Contributors ✨
495
-
496
- Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
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
- ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/npx.gif)
559
-
560
- ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/auth-example.gif)
561
-
562
- ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/typings1.gif)
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
+ ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/npx.gif)
500
+
501
+ ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/auth-example.gif)
502
+
503
+ ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/typings1.gif)
504
+
505
+ ## πŸ“ License
506
+
566
507
  Licensed under the [MIT License](https://github.com/acacode/swagger-typescript-api/blob/master/LICENSE).