Installation
-
Add this line to your Hanami application's Gemfile:
gem "oas_namai"`
-
Execute:
bundle
-
Mount the engine in your config/routes.rb file at the bottom of all routes to ensure it doesn't interfere with your application's routing:
mount OasHanami::Web::View, at: "/docs"
-
The most important step: add the route inspector before starting the app. It can be do in your
config.ru
file:require "hanami/boot" Hanami.app.router(inspector: OasHanami::Inspector.new) # set before run the app. run Hanami.app
You'll now have basic documentation based on your routes and automatically gathered information at localhost:2300/docs
. To enhance it, create an initializer file and add Yard tags to your controller methods.