Skip to content

Commit f2ae8da

Browse files
feat: support vue-query
1 parent b0002f5 commit f2ae8da

File tree

14 files changed

+335
-58
lines changed

14 files changed

+335
-58
lines changed

.changeset/red-plants-breathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openapi-ts-request': minor
3+
---
4+
5+
feat: support vue-query

README-en_US.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ based on [Swagger2/OpenAPI3/Apifox](https://swagger.io/blog/news/whats-new-in-op
1010
- request client(support any client)
1111
- request mock service
1212
- enum and enum translation
13-
- react-query
13+
- react-query/vue-query
1414
- type field label
1515
- JSON Schemas
1616

@@ -19,7 +19,7 @@ docs:[use docs](https://github.com/openapi-ui/openapi-ts-request/issues/100)
1919
## Features
2020

2121
- support Swagger2.0/OpenAPI/Apifox 3.0,3.1 specification
22-
- generate TypeScript/JavaScript, reuquest client(support any client), request mock service, enum and enum translation, react-query, type field label, JSON Schemas
22+
- generate TypeScript/JavaScript, reuquest client(support any client), request mock service, enum and enum translation, react-query/vue-query, type field label, JSON Schemas
2323
- support work with npx, CLI, Nodejs
2424
- support custom request function, Fetch、Axios、[UniApp-request](https://github.com/openapi-ui/openapi-ts-request/issues/46)、Taro-Request、Node.js、XHR client available
2525
- support filter generate result by tags
@@ -195,6 +195,7 @@ $ openapi --help
195195
--requestImportStatement <string> custom request import statement, for example: "const request = require('@/request')"
196196
--apiPrefix <string> custom the prefix of the api path, for example: "api"(variable), "'api'"(string)
197197
--isGenReactQuery <boolean> generate react-query (default: false)
198+
--reactQueryMode <string> react-query mode, react/vue (default: "react")
198199
--isGenJavaScript <boolean> generate JavaScript (default: false)
199200
--isDisplayTypeLabel <boolean> generate label matching type field (default: false)
200201
--isGenJsonSchemas <boolean> generate JSON Schemas (default: false)
@@ -230,6 +231,7 @@ openapi -i ./spec.json -o ./apis
230231
| requestImportStatement | no | string | - | custom request import statement, for example: "const request = require('@/request')" |
231232
| apiPrefix | no | string | - | custom the prefix of the api path, for example: 'api'(variable), "'api'"(string) |
232233
| isGenReactQuery | no | boolean | false | generate react-query |
234+
| reactQueryMode | no | string | 'react' | react-query mode, react/vue |
233235
| isGenJavaScript | no | boolean | false | generate JavaScript |
234236
| isDisplayTypeLabel | no | boolean | false | generate label matching type field |
235237
| isGenJsonSchemas | no | boolean | false | generate JSON Schemas |

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- 客户端请求函数(支持任意客户端)
1111
- 模拟请求响应服务
1212
- 枚举和枚举翻译
13-
- react-query
13+
- react-query/vue-query
1414
- 类型字段翻译
1515
- JSON Schemas
1616

@@ -19,7 +19,7 @@
1919
## 功能
2020

2121
- 支持 Swagger2.0/OpenAPI/Apifox 3.0,3.1 定义
22-
- 生成 TypeScript/JavaScript, 请求客户端(支持任意客户端), 请求模拟服务, 枚举和枚举翻译, react-query, 类型字段翻译, JSON Schemas
22+
- 生成 TypeScript/JavaScript, 请求客户端(支持任意客户端), 请求模拟服务, 枚举和枚举翻译, react-query/vue-query, 类型字段翻译, JSON Schemas
2323
- 支持通过 npx、CLI、Nodejs 的方式使用
2424
- 支持自定义请求工具函数, 支持 Fetch、Axios、[UniApp-Request](https://github.com/openapi-ui/openapi-ts-request/issues/46)、Taro-Request、Node.js、XHR 客户端
2525
- 支持通过 tags 过滤生成结果
@@ -195,6 +195,7 @@ $ openapi --help
195195
--requestImportStatement <string> custom request import statement, for example: "const request = require('@/request')"
196196
--apiPrefix <string> custom the prefix of the api path, for example: "api"(variable), "'api'"(string)
197197
--isGenReactQuery <boolean> generate react-query (default: false)
198+
--reactQueryMode <string> react-query mode, react/vue (default: "react")
198199
--isGenJavaScript <boolean> generate JavaScript (default: false)
199200
--isDisplayTypeLabel <boolean> generate label matching type field (default: false)
200201
--isGenJsonSchemas <boolean> generate JSON Schemas (default: false)
@@ -230,6 +231,7 @@ openapi --i ./spec.json --o ./apis
230231
| requestImportStatement || string | - | 自定义请求方法表达式,例如:"const request = require('@/request')" |
231232
| apiPrefix || string | - | api path的前缀,例如:'api'(动态变量), "'api'"(字符串) |
232233
| isGenReactQuery || boolean | false | 是否生成 react-query |
234+
| reactQueryMode || string | 'react' | react-query 模式,可选 react/vue |
233235
| isGenJavaScript || boolean | false | 是否生成 JavaScript |
234236
| isDisplayTypeLabel || boolean | false | 是否生成 type 对应的label |
235237
| isGenJsonSchemas || boolean | false | 是否生成 JSON Schemas |

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "openapi-ts-request",
33
"version": "1.0.1",
4-
"description": "Swagger2/OpenAPI3/Apifox to TypeScript/JavaScript, request client(support any client), request mock service, enum and enum translation, react-query, type field label, JSON Schemas",
4+
"description": "Swagger2/OpenAPI3/Apifox to TypeScript/JavaScript, request client(support any client), request mock service, enum and enum translation, react-query/vue-query, type field label, JSON Schemas",
55
"packageManager": "[email protected]",
66
"engines": {
77
"node": ">=18.0.0",
@@ -63,6 +63,7 @@
6363
"@commitlint/cli": "^19.2.1",
6464
"@commitlint/config-conventional": "^19.2.2",
6565
"@tanstack/react-query": "^5.62.10",
66+
"@tanstack/vue-query": "^5.62.16",
6667
"@types/js-yaml": "^4.0.9",
6768
"@types/lodash": "^4.17.5",
6869
"@types/memoizee": "^0.4.11",

0 commit comments

Comments
 (0)