- 下载swagger的doc
- 使用swagger codegen生成client
java -jar swagger-codegen-cli-2.4.1.jar generate -i swagger.yaml -l javascript -o abc
- 使用client
var SwaggerPetstore = require('swagger_petstore');
var apiInstance = new SwaggerPetstore.StoreApi();
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data.test);
}
};
apiInstance.getInventory(callback);
网友评论