postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.84k stars 839 forks source link

Feature request: body request generation according to Swagger service contract #1235

Open ghost opened 9 years ago

ghost commented 9 years ago

Hi!

Is there any possibilities (even in non-free version) to generate e.g. body for POST request according to my API contract? I.e. i upload my Swagger contract to Postman and it generates stubs for all requests (like it implemented for GET methods now, URL with stub parameters generated and then values of this parameters may be edited), probably in JSON format (and even converts it to other formats too!)

Can't find any information about this functionality. I think it wolud be a killer-feature if it will be possible to generate body stubs like this!

mm-gmbd commented 8 years ago

+1 for stubbing out body parameters.

Also, important to keep in mind that in Swagger, for a particular operation object, there can be many parameters and where they are in the request is defined by the in parameter. By the specification, the parameters object is defined as:

A list of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it, but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the Swagger Object's parameters. There can be one "body" parameter at most.

The last sentence is very important. If a parameter's in is body, then the actual body parameters are defined in JSON Schema v4 format in the parameter's schema.

For a reference, I've been using the swagger-js-codegen tool and have opened a PR there to parse out those body parameters.

By parsing this all out, Postman could (very intelligently) stub out body parameters, based on the type, required, and other fields in the schema.

mm-gmbd commented 8 years ago

@SunriseJJJ, could you include "Swagger" in the title of your issue? It took me a little while to find this issue considering only the term "contract" was used.

JamesMessinger commented 8 years ago

+1 ;) @a85

benjackwhite commented 8 years ago

+1 for this. This and securityDefinitions is the only thing stopping me from automating the generation and publication of our API directly to a swagger collection

harryjday commented 7 years ago

Any update on this?

kams-mash commented 7 years ago

+1. Very useful and needed feature.

beingmohit commented 7 years ago

+1

bryankindleysonos commented 7 years ago

+1!

RyanKys commented 7 years ago

+1 for this. This is a very useful feature to streamline development. I am using Spring Rest Controller + Swagger UI to generate the Swagger Spec -> Import to postman -> **[Tidy up it in Postman] -> Gradle + Newman test automation. This feature can save a lot of rework / human mistake when preparing API testing in Postman

l2eady commented 6 years ago

+1

finalsnd commented 6 years ago

+1 👍

ValiDraganescu commented 6 years ago

+1

justasitsounds commented 6 years ago

+1

rodrigoimas commented 5 years ago

+1

abourne1 commented 5 years ago

+1

kimpenguin commented 5 years ago

+1