Class: OpenapiController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- OpenapiController
- Defined in:
- app/controllers/openapi_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/openapi_controller.rb', line 4 def index @specs = Openapi.apis.map do |name, config| title = config[:title] spec_path = "#{config[:base_path]}/spec" [title, spec_path] end @default_specification_path = @specs.first ? @specs.first[1] : '' render 'index', layout: false end |
#spec ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/openapi_controller.rb', line 16 def spec name = params[:name] || :default config = Openapi.apis[name] controllers = config[:controllers] json_schema = Swagger::Blocks.build_root_json(controllers) render json: json_schema end |