{"_id":"@alioth_91/openapi","_rev":"4-976decefd46e22bd62b26516098073bc","name":"@alioth_91/openapi","description":"[![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript) [![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@um","dist-tags":{"latest":"1.12.1"},"versions":{"1.9.0":{"name":"@alioth_91/openapi","version":"1.9.0","author":{"name":"chenshuai2144"},"license":"MIT","_id":"@alioth_91/openapi@1.9.0","maintainers":[{"name":"alioth_91","email":"z610886764@163.com"}],"homepage":"https://github.com/chenshuai2144/openapi2typescript#readme","bugs":{"url":"https://github.com/chenshuai2144/openapi2typescript/issues"},"dist":{"shasum":"d8cb91b1135237291ef42a106214dca39ab3d9a3","tarball":"https://registry.npmjs.org/@alioth_91/openapi/-/openapi-1.9.0.tgz","fileCount":21,"integrity":"sha512-wm/x3kR+h6fRYhIWrxT7VWyFQG7GUQ+/ohs8hl77M0aecuJGKkmc6jviMccYzXY6bzCbHScs9cQS2Ator0aWRA==","signatures":[{"sig":"MEQCIEW8dI4jM31iH/Q+TsCVX+/wUgb8KO3rKHEzVt2qDKp9AiBOUtaj8/hyXu/OLWkGYFnJjzmDAp9d9Ou5aVte9yqCTw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":99315},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"21cfa4552b1c896eb34ee33a157f217d9bc9e035","scripts":{"test":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd ..","build":"tsc","start":"tsc -w","test:windows":"rimraf ./test/servers/ ./test/servers-allof/ ./test/file-servers/ && npm run build && cd ./test && ts-node ./test.js --project tsconfig.json && cd ..","localConvert4Project":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd .. && rm -rf /Users/fd/wj/psp-web-pro/src/services/wj && mv ./test/servers/api/  /Users/fd/wj/psp-web-pro/src/services/wj"},"_npmUser":{"name":"alioth_91","email":"z610886764@163.com"},"repository":{"url":"git+ssh://git@github.com/chenshuai2144/openapi2typescript.git","type":"git"},"_npmVersion":"8.15.0","description":"[![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript)\r [![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@u","directories":{},"_nodeVersion":"16.17.1","dependencies":{"glob":"^7.1.6","chalk":"^4.1.2","dayjs":"^1.10.3","lodash":"^4.17.21","mockjs":"^1.1.0","rimraf":"^3.0.2","mock.js":"^0.2.0","memoizee":"^0.4.15","nunjucks":"^3.2.2","prettier":"^2.2.1","node-fetch":"^2.6.1","openapi3-ts":"^2.0.1","tiny-pinyin":"^1.3.2","@umijs/fabric":"^2.5.6","reserved-words":"^0.1.2","swagger2openapi":"^7.0.4"},"_hasShrinkwrap":false,"devDependencies":{"np":"^7.2.0","tslib":"^2.6.0","typescript":"^4.1.3","@types/node":"^14.14.22","@types/express":"^4.17.11"},"_npmOperationalInternal":{"tmp":"tmp/openapi_1.9.0_1695632626252_0.9200105536105274","host":"s3://npm-registry-packages"}},"1.9.1-0":{"name":"@alioth_91/openapi","version":"1.9.1-0","author":{"name":"chenshuai2144"},"license":"MIT","_id":"@alioth_91/openapi@1.9.1-0","maintainers":[{"name":"alioth_91","email":"z610886764@163.com"}],"homepage":"https://github.com/chenshuai2144/openapi2typescript#readme","bugs":{"url":"https://github.com/chenshuai2144/openapi2typescript/issues"},"dist":{"shasum":"71ef51698d2b41e2de5ebfc8ad1021fe4f0300a4","tarball":"https://registry.npmjs.org/@alioth_91/openapi/-/openapi-1.9.1-0.tgz","fileCount":21,"integrity":"sha512-0+8NLiAkDZ2Abg9yNtJR/nxY9139glKuzwCoxFDetki1B3UJNupAKnvi15n6zfD9QeqPPoRfdg9njOIBszk2Qw==","signatures":[{"sig":"MEYCIQChVwupLqSEqklAIB/Vw8G9vJT1EAqF1zIE7wjBzMZVHgIhAKp3pgl6N8ugoAVacUW4/By8gFrLffWEvurGrl+1gYaq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":99823},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"3eceeb08049d762b93a6df32d1e6ad5fb7ef7c3d","scripts":{"test":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd ..","build":"tsc","start":"tsc -w","test:windows":"rimraf ./test/servers/ ./test/servers-allof/ ./test/file-servers/ && npm run build && cd ./test && ts-node ./test.js --project tsconfig.json && cd ..","prepublishOnly":"npm run build && np --no-cleanup --yolo --no-publish --any-branch","localConvert4Project":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd .. && rm -rf /Users/fd/wj/psp-web-pro/src/services/wj && mv ./test/servers/api/  /Users/fd/wj/psp-web-pro/src/services/wj"},"_npmUser":{"name":"alioth_91","email":"z610886764@163.com"},"repository":{"url":"git+ssh://git@github.com/chenshuai2144/openapi2typescript.git","type":"git"},"_npmVersion":"8.15.0","description":"[![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript)\r [![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@u","directories":{},"_nodeVersion":"16.17.1","dependencies":{"glob":"^7.1.6","chalk":"^4.1.2","dayjs":"^1.10.3","lodash":"^4.17.21","mockjs":"^1.1.0","rimraf":"^3.0.2","mock.js":"^0.2.0","memoizee":"^0.4.15","nunjucks":"^3.2.2","prettier":"^2.2.1","node-fetch":"^2.6.1","openapi3-ts":"^2.0.1","tiny-pinyin":"^1.3.2","@umijs/fabric":"^2.5.6","reserved-words":"^0.1.2","swagger2openapi":"^7.0.4"},"_hasShrinkwrap":false,"devDependencies":{"np":"^7.2.0","tslib":"^2.6.0","typescript":"^4.1.3","@types/node":"^14.14.22","@types/express":"^4.17.11"},"_npmOperationalInternal":{"tmp":"tmp/openapi_1.9.1-0_1695635872419_0.41988013549500325","host":"s3://npm-registry-packages"}},"1.9.1":{"name":"@alioth_91/openapi","version":"1.9.1","author":{"name":"chenshuai2144"},"license":"MIT","_id":"@alioth_91/openapi@1.9.1","maintainers":[{"name":"alioth_91","email":"z610886764@163.com"}],"homepage":"https://github.com/chenshuai2144/openapi2typescript#readme","bugs":{"url":"https://github.com/chenshuai2144/openapi2typescript/issues"},"dist":{"shasum":"ed7f3d34e9f6a396c6e97968480373cbc8a1044b","tarball":"https://registry.npmjs.org/@alioth_91/openapi/-/openapi-1.9.1.tgz","fileCount":21,"integrity":"sha512-fsN7LW1fq2TEJ4J2E37lsErVwvJNNOlE5ffW5M3rkTxsYhG697K6/3nZ6CpYCx2AxqKP33pPiRMMZQP/PPzG6w==","signatures":[{"sig":"MEYCIQC9b5LfpDV9haMjzhr7hxNcdE1kXPoAXYkW9qJJs6vrVQIhAOVq/ffKgBBCs4iThMwEw9QmzgpoW3N3VEeI/IbpD69U","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":99821},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"2ef17dc1d1930d714ecc147e7db9cd1c4fe56579","scripts":{"test":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd ..","build":"tsc","start":"tsc -w","test:windows":"rimraf ./test/servers/ ./test/servers-allof/ ./test/file-servers/ && npm run build && cd ./test && ts-node ./test.js --project tsconfig.json && cd ..","prepublishOnly":"npm run build && np --no-cleanup --yolo --no-publish --any-branch","localConvert4Project":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd .. && rm -rf /Users/fd/wj/psp-web-pro/src/services/wj && mv ./test/servers/api/  /Users/fd/wj/psp-web-pro/src/services/wj"},"_npmUser":{"name":"alioth_91","email":"z610886764@163.com"},"repository":{"url":"git+ssh://git@github.com/chenshuai2144/openapi2typescript.git","type":"git"},"_npmVersion":"8.15.0","description":"[![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript)\r [![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@u","directories":{},"_nodeVersion":"16.17.1","dependencies":{"glob":"^7.1.6","chalk":"^4.1.2","dayjs":"^1.10.3","lodash":"^4.17.21","mockjs":"^1.1.0","rimraf":"^3.0.2","mock.js":"^0.2.0","memoizee":"^0.4.15","nunjucks":"^3.2.2","prettier":"^2.2.1","node-fetch":"^2.6.1","openapi3-ts":"^2.0.1","tiny-pinyin":"^1.3.2","@umijs/fabric":"^2.5.6","reserved-words":"^0.1.2","swagger2openapi":"^7.0.4"},"_hasShrinkwrap":false,"devDependencies":{"np":"^7.2.0","tslib":"^2.6.0","typescript":"^4.1.3","@types/node":"^14.14.22","@types/express":"^4.17.11"},"_npmOperationalInternal":{"tmp":"tmp/openapi_1.9.1_1695637393223_0.6348118797560323","host":"s3://npm-registry-packages"}},"1.9.2":{"name":"@alioth_91/openapi","version":"1.9.2","author":{"name":"chenshuai2144"},"license":"MIT","_id":"@alioth_91/openapi@1.9.2","maintainers":[{"name":"alioth_91","email":"z610886764@163.com"}],"homepage":"https://github.com/chenshuai2144/openapi2typescript#readme","bugs":{"url":"https://github.com/chenshuai2144/openapi2typescript/issues"},"dist":{"shasum":"a96c3ab90e5b770eb515d6690ca2bf05faaf6a0a","tarball":"https://registry.npmjs.org/@alioth_91/openapi/-/openapi-1.9.2.tgz","fileCount":21,"integrity":"sha512-EXz5PiBLwh/C8WctiC6VD2l8KGtdjQsPUA4AjvcSPWdcGz/7AxZVYepRjC77urGI4UaJtU55DqQeOfHmgBiKog==","signatures":[{"sig":"MEQCIBP05fJhPNZiHtkzCHeOEXaGHUypoqr532JbHcwa1Se1AiAurE5EKyu5vJfY/QQ7o2LcOfOMv0tj3Tb7EDImtwODiA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":103141},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"3150a9c1bac841b7bc1b05bfec6f1e656bde2b16","scripts":{"test":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd ..","build":"tsc","start":"tsc -w","test:windows":"rimraf ./test/servers/ ./test/servers-allof/ ./test/file-servers/ && npm run build && cd ./test && ts-node ./test.js --project tsconfig.json && cd ..","prepublishOnly":"npm run build && np --no-cleanup --yolo --no-publish --any-branch","localConvert4Project":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd .. && rm -rf /Users/fd/wj/psp-web-pro/src/services/wj && mv ./test/servers/api/  /Users/fd/wj/psp-web-pro/src/services/wj"},"_npmUser":{"name":"alioth_91","email":"z610886764@163.com"},"repository":{"url":"git+ssh://git@github.com/chenshuai2144/openapi2typescript.git","type":"git"},"_npmVersion":"8.15.0","description":"[![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript)\r [![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@u","directories":{},"_nodeVersion":"16.17.1","dependencies":{"glob":"^7.1.6","chalk":"^4.1.2","dayjs":"^1.10.3","lodash":"^4.17.21","mockjs":"^1.1.0","rimraf":"^3.0.2","mock.js":"^0.2.0","memoizee":"^0.4.15","nunjucks":"^3.2.2","prettier":"^2.2.1","node-fetch":"^2.6.1","openapi3-ts":"^2.0.1","tiny-pinyin":"^1.3.2","@umijs/fabric":"^2.5.6","reserved-words":"^0.1.2","swagger2openapi":"^7.0.4"},"_hasShrinkwrap":false,"devDependencies":{"np":"^7.2.0","tslib":"^2.6.0","typescript":"^4.1.3","@types/node":"^14.14.22","@types/express":"^4.17.11"},"_npmOperationalInternal":{"tmp":"tmp/openapi_1.9.2_1696672147646_0.8873167169070506","host":"s3://npm-registry-packages"}},"1.12.1":{"name":"@alioth_91/openapi","version":"1.12.1","description":"[![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript) [![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@um","repository":{"type":"git","url":"git+ssh://git@github.com/chenshuai2144/openapi2typescript.git"},"license":"MIT","author":{"name":"chenshuai2144"},"main":"dist/index.js","scripts":{"build":"tsc","localConvert4Project":"rm -rf ./test/servers/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd .. && rm -rf /Users/fd/wj/psp-web-pro/src/services/wj && mv ./test/servers/api/  /Users/fd/wj/psp-web-pro/src/services/wj","prepublishOnly":"npm run build && np --no-cleanup --yolo --no-publish --any-branch","start":"tsc -w","test":"rm -rf ./test/servers/ ./test/servers-allof/ ./test/file-servers/ &&  npm run build && cd ./test && node ./test.js && cd ..","test:windows":"rimraf ./test/servers/ ./test/servers-allof/ ./test/file-servers/ && npm run build && cd ./test && ts-node ./test.js --project tsconfig.json && cd .."},"dependencies":{"@umijs/fabric":"^2.5.6","chalk":"^4.1.2","dayjs":"^1.10.3","glob":"^7.1.6","lodash":"^4.17.21","memoizee":"^0.4.15","mock.js":"^0.2.0","mockjs":"^1.1.0","node-fetch":"^2.6.1","nunjucks":"^3.2.2","openapi3-ts":"^2.0.1","prettier":"^2.2.1","reserved-words":"^0.1.2","rimraf":"^3.0.2","swagger2openapi":"^7.0.4","tiny-pinyin":"^1.3.2"},"devDependencies":{"@types/express":"^4.17.11","@types/node":"^14.14.22","np":"^7.2.0","tslib":"^2.6.0","typescript":"^4.1.3"},"_id":"@alioth_91/openapi@1.12.1","gitHead":"a824f5da262c698ae988c4159096b2c7bfa000b0","types":"./dist/index.d.ts","bugs":{"url":"https://github.com/chenshuai2144/openapi2typescript/issues"},"homepage":"https://github.com/chenshuai2144/openapi2typescript#readme","_nodeVersion":"21.0.0","_npmVersion":"10.2.0","dist":{"integrity":"sha512-QR3xwbSf8kxmfZEIyWGJrM5IbhAiVTN03z1v6oeydK+XDWYonJVEIzcwjUc6oEZmCRURdrj0FEAPuYvVtphzUg==","shasum":"e267a98e1290544fdcbf26a58cd95b2745873c47","tarball":"https://registry.npmjs.org/@alioth_91/openapi/-/openapi-1.12.1.tgz","fileCount":21,"unpackedSize":106106,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUUTjMQQQj4O4R2X1Nf6b2Q8hxywdgFMt3HHdOyUKtMwIhAPMdVPcrcfnRCBdTBXx4MlcAiWynJ2PX1QwNpSU0vU1w"}]},"_npmUser":{"name":"alioth_91","email":"z610886764@163.com"},"directories":{},"maintainers":[{"name":"alioth_91","email":"z610886764@163.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/openapi_1.12.1_1718800243883_0.8176586040987393"},"_hasShrinkwrap":false}},"time":{"created":"2023-09-25T09:03:46.158Z","modified":"2024-06-19T12:30:44.272Z","1.9.0":"2023-09-25T09:03:46.453Z","1.9.1-0":"2023-09-25T09:57:52.680Z","1.9.1":"2023-09-25T10:23:13.429Z","1.9.2":"2023-10-07T09:49:07.937Z","1.12.1":"2024-06-19T12:30:44.110Z"},"maintainers":[{"name":"alioth_91","email":"z610886764@163.com"}],"author":{"name":"chenshuai2144"},"repository":{"type":"git","url":"git+ssh://git@github.com/chenshuai2144/openapi2typescript.git"},"license":"MIT","homepage":"https://github.com/chenshuai2144/openapi2typescript#readme","bugs":{"url":"https://github.com/chenshuai2144/openapi2typescript/issues"},"readme":"## 介绍\n[![GitHub Repo stars](https://img.shields.io/github/stars/chenshuai2144/openapi2typescript?style=social)](https://github.com/chenshuai2144/openapi2typescript)\n[![npm (scoped)](https://img.shields.io/npm/v/@umijs/openapi)](https://www.npmjs.com/package/@umijs/openapi)\n![GitHub tag (latest SemVer pre-release)](https://img.shields.io/github/v/tag/chenshuai2144/openapi2typescript?include_prereleases)\n\n根据 [OpenApi3](https://swagger.io/blog/news/whats-new-in-openapi-3-0/) 文档生成 request 请求代码。\n\n如果你使用 [umi](https://umijs.org) ,你可以使用[@umijs/plugin-openapi](https://www.npmjs.com/package/@umijs/plugin-openapi) 插件。\n## 使用\n```node\nnpm i --save-dev @umijs/openapi\n```\n在项目根目录新建 ```openapi.config.ts```\n```ts\nconst { generateService } = require('@umijs/openapi')\n\ngenerateService({\n  schemaPath: 'http://petstore.swagger.io/v2/swagger.json',\n  serversPath: './servers',\n})\n\n```\n在 ```package.json``` 的 ```script``` 中添加 api: ```\"openapi\": \"ts-node openapi.config.ts\",```\n\n生成api\n```node\nnpm run openapi\n```\n## 参数\n|  属性   | 必填  | 备注 | 类型 | 默认值 |\n|  ----  | ----  |  ----  |  ----  | - |\n| requestLibPath  | 否 | 自定义请求方法路径 | string | - |\n| requestOptionsType  | 否 | 自定义请求方法 options 参数类型 | string | {[key: string]: any} |\n| requestImportStatement  | 否 | 自定义请求方法表达式 | string | - |\n| apiPrefix  | 否 | api 的前缀 | string | - |\n| serversPath  | 否 | 生成的文件夹的路径 | string | - |\n| schemaPath  | 否 | Swagger 2.0 或 OpenAPI 3.0 的地址 | string | - |\n| projectName  | 否 | 项目名称 | string | - |\n| namespace  | 否 | 命名空间名称 | string | API |\n| mockFolder  | 否 | mock目录 | string | - |\n| enumStyle  | 否 | 枚举样式 | string-literal \\| enum | string-literal |\n| nullable | 否 | 使用null代替可选 | boolean | false |\n| dataFields | 否 | response中数据字段 | string[] | - |\n| isCamelCase | 否 | 小驼峰命名文件和请求函数 | boolean | true |\n| hook | 否 | 自定义 hook | [Custom Hook](#Custom-Hook) | - |\n\n## Custom Hook\n\n| 属性           | 类型 | 说明               |\n| -------------- | ---- | ------------------ |\n| afterOpenApiDataInited | (openAPIData: OpenAPIObject) => OpenAPIObject  | - |\n| customFunctionName | (data: APIDataType) => string   | 自定义请求方法函数名称 |\n| customTypeName | (data: APIDataType) => string | 自定义类型名称 |\n| customClassName | (tagName: string) => string  | 自定义类名 |\n| customType | (<br>schemaObject: SchemaObject \\| undefined,<br>namespace: string,<br>originGetType:(schemaObject: SchemaObject \\| undefined, namespace: string) => string,<br>) => string  | 自定义获取类型 <br> *返回非字符串将使用默认方法获取type* |\n| customFileNames |  (<br>operationObject: OperationObject,<br>apiPath: string,<br>_apiMethod: string,<br>) => string[]   | 自定义生成文件名，可返回多个，表示生成多个文件. <br> *返回为空，则使用默认的获取方法获取* |\n","readmeFilename":"README.md"}