swagger+jest

  1. 下载swagger的doc
  2. 使用swagger codegen生成client
java -jar swagger-codegen-cli-2.4.1.jar generate -i swagger.yaml -l javascript -o abc
  1. 使用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);

你可能感兴趣的:(swagger+jest)