Using Swagger2 can be more convenient to generate API documents and test the interface, but the experience is much worse than Postman and cannot be saved. Fortunately, Swagger data can be imported into Postman. The following will demonstrate how to import it

Import Swagger data into Postman

Once the project is running, you can access the /v2/api-docs path directly. We just need to import this path into Postman to generate Collections, as shown below:

The key to Swagger2 in combination with Postman is to specify the correct paramType, which provides five types: Form Query Body Path Header In the project at the bottom of this article, below is the interface generated when path is specified

The problem

After Swagger2 is imported, baseUrl variable will be generated automatically. Its value is //host:port/. We need to change it. Otherwise, the final request will become http:////host:port/ and the request will fail. Click Collection -> Edit -> Variables to modify it!

other

Related code in Swagger2 best practices