-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add or convert a Collection Pre-Request Script? #158
Comments
@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 |
@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):
The text was updated successfully, but these errors were encountered: