Open skplunkerin opened 4 years ago
@skplunkerin Is there a similar workflow in the other tools that you use that supports something similar?
We could explore Postman vendor-extensions in OAS that allow you to specify a X-Postman-PreRequestScript
in your OpenAPI document, that's included as a pre-request script in the generated collection.
@abhijitkane I was actually thinking the same thing about using OAS vendor extensions for this, and other Postman specific things.
Right now I'm currently breaking OAS validation by adding a non-supported component (not related to PreRequest Scripts) that I need for Postman, but OAS doesn't recognize. It would be really nice to have multiple Postman-specific features that I can add directly to my OAS file using vendor extensions, so both OAS and Postman are happy.
I agree - it would be nice to automate certain post api collection generation steps via a custom oas3 definition
Right now it's pretty burdensome to reapply all custom Postman features to an oas3-generated collection on each release
The openapi-to-postman package focusses on transforming a OpenAPI document to a Postman collection.
To make the transformation more dynamic, we have created a seperate package Portman that uses "openapi-to-postman" under the hood to transform OpenAPI document to a Postman collection, but while doing so, it offers options to generate automat tests, insert postman variables, prefill Params / Headers / Body values with environment variables, add pre-request scripts, ...
We initially created a PR (#225) on "openapi-to-postman", but it didnt feel right to mix functionality and that is why we created the Portman package, next to openapi-to-postman, leveraging openapi-to-postman but with automation, API testing & making Postman more dynamic in mind.
Wow, I just sat down to finish a PR for this feature. I'll be checking out portman, thanks @thim81!
How can I include a Collection Pre-Request Script?
I have a Collection Pre-Request Script that will setup a header for all requests made by my collection, but I can't find how to add this script into OpenAPI format to be converted correctly? OR is there a way the package can insert this script instead of adding it in OpenAPI?
Here's the script I'm wanting to include after running
openapi-to-postmanv2
:When I manually add this to my collection and export it, it will appear like this in the export json (edited for brevity):