Reputation: 81
I want to generate a sample request and response from a swagger definition file(yaml/json). The intent is to stub out these APIs.
Unfortunately I do not have admin rights to install any of the server frameworks listed in the generate server list of the swagger editor. I've also tried mocking it with soapui(5.x) and ready api , but both of them are not able to resolve the schema references within the response objects of the definition file - Eg:
"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,
Upvotes: 8
Views: 15570
Reputation: 2881
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.
Upvotes: 0