swagger-typescript-api 13.0.4 → 13.0.6

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/LICENSE CHANGED
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
19
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
20
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
21
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,30 +1,15 @@
1
1
  # swagger-typescript-api
2
2
 
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
- />
3
+ - Support for OpenAPI 3.0, 2.0, JSON and YAML
4
+ - Generate the API client for Fetch or Axios from an OpenAPI Specification
10
5
 
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.
6
+ Any questions you can ask [**here**](https://github.com/acacode/swagger-typescript-api/discussions)
14
7
 
15
- <br>
8
+ ## Examples
16
9
 
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)
10
+ All examples you can find [**here**](https://github.com/acacode/swagger-typescript-api/tree/main/tests)
18
11
 
19
- ![](https://raw.githubusercontent.com/acacode/swagger-typescript-api/master/assets/components-converter-example.jpg)
20
-
21
- Thanks to [JetBrains](https://www.jetbrains.com/?from=swaggertypescriptapi) for providing a free license for their excellent Webstorm IDE.
22
-
23
- ## 👀 Examples
24
-
25
- All examples you can find [**here**](https://github.com/acacode/swagger-typescript-api/tree/master/tests)
26
-
27
- ## 📄 Usage
12
+ ## Usage
28
13
 
29
14
  ```muse
30
15
  Usage: sta [options]
@@ -203,7 +188,7 @@ generateTemplates({
203
188
  });
204
189
  ```
205
190
 
206
- ## 💎 options
191
+ ## Options
207
192
 
208
193
  ### **`--templates`**
209
194
 
@@ -487,21 +472,13 @@ generateApi({
487
472
 
488
473
  See more about [swagger schema type/format data here](https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times)
489
474
 
490
- ## 📄 Mass media
475
+ ## Mass media
491
476
 
492
477
  - [5 Lessons learned about swagger-typescript-api](https://christo8989.medium.com/5-lessons-learned-about-swagger-typescript-api-511240b34c1)
493
478
  - [Why Swagger schemes are needed in frontend development ?](https://dev.to/js2me/why-swagger-schemes-are-needed-in-frontend-development-2cb4)
494
479
  - [Migration en douceur vers TypeScript (French)](https://www.premieroctet.com/blog/migration-typescript/)
495
480
  - [swagger-typescript-api usage (Japanese)](https://zenn.dev/watahaya/articles/2f4a716c47903b)
496
481
 
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
482
+ ## License
506
483
 
507
- Licensed under the [MIT License](https://github.com/acacode/swagger-typescript-api/blob/master/LICENSE).
484
+ Licensed under the [MIT License](https://github.com/acacode/swagger-typescript-api/blob/main/LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-typescript-api",
3
- "version": "13.0.4",
3
+ "version": "13.0.6",
4
4
  "description": "Generate TypeScript/JavaScript API from Swagger schema",
5
5
  "homepage": "https://github.com/acacode/swagger-typescript-api",
6
6
  "bugs": "https://github.com/acacode/swagger-typescript-api/issues",
@@ -30,61 +30,7 @@
30
30
  "cli:yaml": "node index.js -r -d -p ./swagger-test-cli.yaml -n swagger-test-cli.ts",
31
31
  "format": "biome format --write .",
32
32
  "format:check": "biome format .",
33
- "generate": "node tests/generate.js",
34
- "generate-extended": "node tests/generate-extended.js",
35
- "node": "node swagger-test-cli/generate.js",
36
- "node:debug": "node --nolazy swagger-test-cli/generate.js",
37
- "test-all": "yarn test-extended && yarn test-simple && yarn test-specific",
38
- "test-all(update-snapshots)": "cross-env UPDATE_SNAPSHOTS=true yarn test-all",
39
- "test-extended": "node --unhandled-rejections=strict scripts_runner.js generate-extended validate",
40
- "test-simple": "node --unhandled-rejections=strict scripts_runner.js generate validate",
41
- "test-specific": "node --unhandled-rejections=strict scripts_runner.js \"test:*\"",
42
- "test-specific(update-snapshots)": "cross-env UPDATE_SNAPSHOTS=true node --unhandled-rejections=strict scripts_runner.js \"test:*\"",
43
- "test:--add-readonly": "node tests/spec/readonly/test.js",
44
- "test:--another-array-type": "node tests/spec/another-array-type/test.js",
45
- "test:--axios": "node tests/spec/axios/test.js",
46
- "test:--axios--single-http-client": "node tests/spec/axiosSingleHttpClient/test.js",
47
- "test:--cli": "shx rm -rf tests/spec/cli/schema.ts && node index.js -p tests/spec/cli/schema.json -o tests/spec/cli -n schema.ts --extract-response-body --extract-response-error --api-class-name MySuperApi --type-prefix Prefix && node tests/spec/cli/test.js",
48
- "test:--default-as-success": "node tests/spec/defaultAsSuccess/test.js",
49
- "test:--default-response": "node tests/spec/defaultResponse/test.js",
50
- "test:--dot-path-params": "node tests/spec/dot-path-params/test.js",
51
- "test:--enum-names-as-values": "node tests/spec/enumNamesAsValues/test.js",
52
- "test:--extract-request-body": "node tests/spec/extractRequestBody/test.js",
53
- "test:--extract-request-params": "node tests/spec/extractRequestParams/test.js",
54
- "test:--extract-response-body": "node tests/spec/extractResponseBody/test.js",
55
- "test:--extract-response-error": "node tests/spec/extractResponseError/test.js",
56
- "test:--js": "node tests/spec/js/test.js",
57
- "test:--js--axios": "node tests/spec/jsAxios/test.js",
58
- "test:--modular": "node tests/spec/modular/test.js",
59
- "test:--module-name-first-tag": "node tests/spec/moduleNameFirstTag/test.js",
60
- "test:--module-name-index": "node tests/spec/moduleNameIndex/test.js",
61
- "test:--no-client": "node tests/spec/noClient/test.js",
62
- "test:--object-types": "node tests/spec/object-types/test.js",
63
- "test:--patch": "node tests/spec/patch/test.js",
64
- "test:--primitive-type-constructs": "node tests/spec/primitive-type-constructs/test.js",
65
- "test:--responses": "node tests/spec/responses/test.js",
66
- "test:--route-types": "node tests/spec/routeTypes/test.js",
67
- "test:--single-http-client": "node tests/spec/singleHttpClient/test.js",
68
- "test:--templates": "node tests/spec/templates/test.js",
69
- "test:--type-suffix--type-prefix": "node tests/spec/typeSuffixPrefix/test.js",
70
- "test:--union-enums": "node tests/spec/unionEnums/test.js",
71
- "test:additionalProperties2.0": "node tests/spec/additional-properties-2.0/test.js",
72
- "test:another-query-params": "node tests/spec/another-query-params/test.js",
73
- "test:const-keyword": "node tests/spec/const-keyword/test.js",
74
- "test:deprecated": "node tests/spec/deprecated/test.js",
75
- "test:discriminator": "node tests/spec/discriminator/test.js",
76
- "test:enums2.0": "node tests/spec/enums-2.0/test.js",
77
- "test:extra-templates": "node tests/spec/extra-templates/test.js",
78
- "test:extract-enums": "node tests/spec/extract-enums/test.js",
79
- "test:jsSingleHttpClientModular": "node tests/spec/jsSingleHttpClientModular/test.js",
80
- "test:nullableRefTest2.0": "node tests/spec/nullable-2.0/test.js",
81
- "test:nullableRefTest3.0": "node tests/spec/nullable-3.0/test.js",
82
- "test:on-insert-path-param": "node tests/spec/on-insert-path-param/test.js",
83
- "test:partialBaseTemplate": "node tests/spec/partialBaseTemplate/test.js",
84
- "test:partialDefaultTemplate": "node tests/spec/partialDefaultTemplate/test.js",
85
- "test:sort-types": "node tests/spec/sortTypes/test.js",
86
- "test:sort-types-false": "node tests/spec/sortTypes-false/test.js",
87
- "test:specProperty": "node tests/spec/specProperty/test.js",
33
+ "test": "vitest run",
88
34
  "validate": "node tests/validate.js",
89
35
  "validate:debug": "node --nolazy tests/validate.js"
90
36
  },
@@ -97,22 +43,20 @@
97
43
  "lodash": "^4.17.21",
98
44
  "nanoid": "^3.3.7",
99
45
  "node-emoji": "^2.1.3",
100
- "prettier": "3.3.0",
46
+ "prettier": "~3.3.2",
101
47
  "swagger-schema-official": "2.0.0-bab6bed",
102
48
  "swagger2openapi": "^7.0.8",
103
- "typescript": "5.4.5"
49
+ "typescript": "~5.4.5"
104
50
  },
105
51
  "devDependencies": {
106
- "@biomejs/biome": "1.7.3",
107
- "@types/lodash": "4.17.4",
108
- "@types/node": "20.13.0",
52
+ "@biomejs/biome": "1.8.1",
53
+ "@types/lodash": "4.17.5",
54
+ "@types/node": "20.14.2",
109
55
  "axios": "1.7.2",
110
- "cross-env": "7.0.3",
111
- "dotenv": "16.4.5",
112
- "git-diff": "2.0.6",
113
- "shx": "0.3.4"
56
+ "shx": "0.3.4",
57
+ "vitest": "1.6.0"
114
58
  },
115
- "packageManager": "yarn@4.2.2",
59
+ "packageManager": "yarn@4.3.0",
116
60
  "engines": {
117
61
  "node": ">=18.0.0"
118
62
  },
@@ -1,3 +1,3 @@
1
1
  <% const { config } = it; %>
2
- <% /* https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/http-clients/ */ %>
3
- <%~ includeFile(`@base/http-clients/${config.httpClientType}-http-client`, it) %>
2
+ <% /* https://github.com/acacode/swagger-typescript-api/tree/main/templates/base/http-clients/ */ %>
3
+ <%~ includeFile(`@base/http-clients/${config.httpClientType}-http-client`, it) %>
@@ -40,4 +40,4 @@ if (route === "/")
40
40
  return _.camelCase(`${_.lowerCase(method)}Root`);
41
41
 
42
42
  return createCustomOperationId(method, route, moduleName);
43
- %>
43
+ %>
@@ -20,4 +20,4 @@ export namespace <%~ routeNamespace %> {
20
20
  export type RequestBody = <%~ (payload && payload.type) || 'never' %>;
21
21
  export type RequestHeaders = <%~ (headers && headers.type) || '{}' %>;
22
22
  export type ResponseBody = <%~ route.response.type %>;
23
- }
23
+ }