1.0.32 • Published 1 year ago

ssapi v1.0.32

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

swagger-codegen

template from swagger-codegen-generators

swagger-codegen-cli.jar

1. 安装

$ npm i ssapi
$ npx ssapi -h

Usage: main [options]

Options:
  -V, --version          output the version number
  -i, --input <type>     location of  the  swagger  spec,  as  URL  or file (default: "https://petstore.swagger.io/v2/swagger.json")  -o, --output <type>    where to write  the  generated  files(current dir by default) (default: "services")
  -t, --template <type>  folder containing the template files (default: "template/typescript-axios-custom")
  -c, --config <type>    config file path
  --init                 init config file
  -l, --lang <type>      client language to generate (default: "typescript-axios")
  -h, --help             display help for command

2. 使用

$ npx ssapi -i swagger.json -o services

3. 使用配置文件

$ npx ssapi --init
$ cat ssapi.config.json 

{
  "input":  "https://petstore.swagger.io/v2/swagger.json",
  "output": "services",
  "lang": "typescript-axios"
}

$ npx ssapi -c ssapi.config.json

4. api调用

import * as API from "../../services"

let api = new API.DefaultApi();
api.Hello({
    Name: "tina",
}, "").then((response) => {
    let result = response.data;
    console.log(result);
}).catch((err) => {

});
1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago