Closed erunion closed 1 year ago
Hi @erunion,
I think that you are missing some features from the library:
👋 Hello! We're going to be integrating this library into our product soon to allow customers to upload Postman collections to us and I noticed an issue where if I import the OpenAPI Petstore example into Postman and then export it out the global server gets set to a baseUrl variable in Postman but that variable never received its default of http://petstore.swagger.io/v2.
If you want the library to automatically replace vars from Postman you need to activate the feature using the option replaceVars
please have a look to the documentation, the Postman collection that you have attached works just activating this flag because the library get the baseUrl
and replace automatically.
After digging into it I found that this library currently did not support server variables.
Servers are automatically extracted from the API URL and if you use variables and activate replaceVars
are also extracted, complementary you can provide additional servers, for example to indicate Sandbox or Production environments, this can be carry on using the servers option, have a look to the documentation and test to see how it works but is very straight fordward.
Best Regards.
Wow this is embarrassing, you're totally right. My bad! Thanks for the help.
👋 Hello! We're going to be integrating this library into our product soon to allow customers to upload Postman collections to us and I noticed an issue where if I import the OpenAPI Petstore example into Postman and then export it out the global
server
gets set to abaseUrl
variable in Postman but that variable never received its default ofhttp://petstore.swagger.io/v2
.After digging into it I found that this library currently did not support server variables.
🧰 Changes
variable
config.servers
library config to supportvariables
as well.📝 OpenAPI Petstore -> Postman export example
```json { "info": { "_postman_id": "0b2e8577-2899-4229-bb1c-4cb031108c2f", "name": "Swagger Petstore", "description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.\n\nContact Support:\n Email: apiteam@swagger.io", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "pet", "item": [ { "name": "{pet Id}", "item": [ { "name": "Find pet by ID", "request": { "auth": { "type": "apikey", "apikey": [ { "key": "key", "value": "api_key", "type": "string" }, { "key": "value", "value": "