DEV Community

Victor Motogna
Victor Motogna

Posted on

Automatically generate Postman collection from Apipie docs

I often found myself having to create a Postman collection from our API so it's easier to test between the members of the team. But each time the collection ends up incomplete and it's a hassle to keep up to date.

For that reason, I created a new Ruby gem (Github) that automatically generates a Postman collection with all the tested endpoints covered with Apipie.

How to use it

The setup & usage are pretty easy:

  • add the gem to your :development, :test group in the Gemfile
  • generate a Postman API key; details here
  • add an initializer file to config/initializers/apipie_postman.rb:
ApipiePostman.configure do |config|
  config.postman_api_key = 'your_postman_api_key'
  config.postman_collection_name = 'Your collection name'
  config.base_url = 'localhost:3000' # the base_url that you want in your postman collection
end
Enter fullscreen mode Exit fullscreen mode
  • run bundle exec apipie-postman - this will create the apipie_postman.rake file
  • run bundle exec rake apipie_postman to run the task and generate docs

Conclusion

Please let me know if you like it and any feedback you might have.

If any of you would like to contribute to the project, I also set up a contributing guideline.

Discussion (0)