api-code-builder
v2.5.7
Published
js/ts api code build from swagger
Downloads
26
Readme
api-code-builder
English | 简体中文
build your axios code from swagger document (not support swagger v3)
and have good Intelligence in vscode
- create jsdoc in js
- create typing in ts
online experience
https://coppyc.github.io/api-code-builder/
get started
yarn add -D api-code-builder
then add npm script "build:api": "api-code-builder"
to your package.json
scripts
{
"scripts": {
"build:api": "api-code-builder"
}
}
finally, run and answer some questions, enjoy it!
yarn build:api
other ways to use
use in node or browser with npm
const apiCodeBuilder = require('api-code-builder')
const docs = { /** */ } // you need to get the swagger document by yourself
const code = apiCodeBuilder.buildApi({
paths: docs.paths,
definitions: docs.definitions,
// version: 'ts',
// customResponse: 'any',
// axiosFrom: './myAxios'
})
console.log(code)
use in browser with cdn
<script src="https://unpkg.com/[email protected]/dist/main.umd.js"></script>
new version plan
- a adapter from swagger to axios in running time.
- output the swagger.json file as the adapter input
- only product js + .d.ts at once then only update without js