class ActionDispatch::Routing::OpenAPI3Formatter

Public Class Methods

new() click to toggle source
# File lib/openapi3_definition_generator/rails/openapi3_formatter.rb, line 7
def initialize()
  @view  = nil
  @buffer = []
  @openapi_structute = {
    'openapi' => '3.0.0',
    'info' => {
      'title' => '',
      'description' => '',
      'version' => '0.1.0'
    },
    'paths' => {}
  }
end

Public Instance Methods

header(routes) click to toggle source
# File lib/openapi3_definition_generator/rails/openapi3_formatter.rb, line 38
def header(routes)
end
no_routes(*) click to toggle source
# File lib/openapi3_definition_generator/rails/openapi3_formatter.rb, line 41
def no_routes(*)
end
result() click to toggle source
# File lib/openapi3_definition_generator/rails/openapi3_formatter.rb, line 44
def result
  YAML.dump @openapi_structute
end
section(routes) click to toggle source
# File lib/openapi3_definition_generator/rails/openapi3_formatter.rb, line 24
def section(routes)
  routes.filter do |r|
    !r[:verb].empty?
  end.each do |r|
    @openapi_structute['paths'][r[:path]] ||= {}
    @openapi_structute['paths'][r[:path]][r[:verb].downcase] = {}
    @openapi_structute['paths'][r[:path]][r[:verb].downcase] = {
      'summary' => r[:name],
      'description' => r[:reqs],
      'responses' => nil
    }
  end
end
section_title(title) click to toggle source
# File lib/openapi3_definition_generator/rails/openapi3_formatter.rb, line 21
def section_title(title)
end