Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate sample request and responses from Swagger Definition

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,

like image 509
amy Avatar asked Nov 09 '22 05:11

amy


1 Answers

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.

like image 132
StephenG Avatar answered Nov 15 '22 06:11

StephenG