Class: SwaggerConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/rrx_dev/rswag.rb

Instance Method Summary collapse

Constructor Details

#initializeSwaggerConfig

Returns a new instance of SwaggerConfig.



47
48
49
# File 'lib/rrx_dev/rswag.rb', line 47

def initialize
  @docs = {}
end

Instance Method Details

#configObject



62
63
64
65
66
67
68
# File 'lib/rrx_dev/rswag.rb', line 62

def config
  RSpec.configure do |config|
    config.swagger_root = Rails.root.join('swagger').to_s
    config.swagger_format = :yaml
    config.swagger_docs = @docs
  end
end

#doc(file, name, version, **schemas) ⇒ Object



51
52
53
54
55
56
57
58
59
60
# File 'lib/rrx_dev/rswag.rb', line 51

def doc(file, name, version, **schemas)
  @docs[file] = {
    openapi:    '3.0.1',
    info:       {
      title:   name,
      version:
    },
    components: { schemas: }
  }
end