How to use Postman Variables in Open API specification

Viewed 546

we are making an Open API specification of our current API. We want to integrate the resulting file with Postman, to generate a collection and be able to make the request easily, without having to update our collections when we make a new change.

Right now, I'm using the following:

openapi: 3.0.0
info:
  version: '1.0.0'
  title: 'Objects API'
servers:
  - url: '{{HOST}}/api/3/users/{{USER_ID}}'

If I use that, then the generated collection looks something like this:

enter image description here

So it works, but the problem with that is that if we now integrate the OpenAPI file with swagger, all the {{...}} will appear on the documentation.

I'm seeing some variables being generated on the collection by postman, like baseUrl:

enter image description here

Though I do not really know how to use that variable in the auto generated requests (that is, that the requests are generated using that variable).

Any idea/tip to fix this and make our collections as usable as possible by them? Ideally the use case is to import the OpenAPI file on Postman and start making valid request replacing as few values as possible.

0 Answers
Related