从Swagger Definition生成样本请求和响应 [英] Generate sample request and responses from Swagger Definition
本文介绍了从Swagger Definition生成样本请求和响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从招摇定义文件(yaml/json)生成示例请求和响应.目的是存根这些API.
很不幸,我没有管理员权限来安装swagger编辑器的generate server列表中列出的任何服务器框架.我还尝试了用soapui(5.x)和ready api模拟它,但是它们都无法解析定义文件的响应对象中的架构引用- 例如:
"responses": {
"200": {
"description": "pet response",
"schema": {
"$ref": "**#/definitions/Pet**"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "**#/definitions/ErrorModel**"
}
}
是否有一种简单的方法可以根据定义生成模拟请求和响应?
谢谢
解决方案
我认为这( Is there a simple way to generate the mock requests and responses from the definition? Thanks, I think this (http://apigee.com/about/blog/developer/swagger-test-templates-test-your-apis) is what you're looking for. It goes through a list of products (Handlebars JS, Mocha JS, Commander JS) and how to orchestrate them to get some test code. 这篇关于从Swagger Definition生成样本请求和响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! 解决方案
查看全文