Class: SwaggerConfig
- Inherits:
-
Object
- Object
- SwaggerConfig
- Defined in:
- lib/rrx_dev/rswag.rb
Instance Method Summary collapse
- #config ⇒ Object
- #doc(file, name, version, **schemas) ⇒ Object
-
#initialize ⇒ SwaggerConfig
constructor
A new instance of SwaggerConfig.
Constructor Details
#initialize ⇒ SwaggerConfig
Returns a new instance of SwaggerConfig.
47 48 49 |
# File 'lib/rrx_dev/rswag.rb', line 47 def initialize @docs = {} end |
Instance Method Details
#config ⇒ Object
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 |