Module: AutoRswag

Defined in:
lib/auto_rswag.rb

Overview

This module hooks into the Rspec test to retrieve useful metadata and submit it to AutoRswagHelper for conversion.

Instance Method Summary collapse

Instance Method Details

#update_documentationObject



11
12
13
14
15
16
17
18
19
# File 'lib/auto_rswag.rb', line 11

def update_documentation
  after do |example|
    title = example.[:response][:schema]['$ref'].split('/').last
    payload = AutoRswagHelper.convert_response(response)
    AutoRswagHelper.map_fields(payload)
    docs = SwaggerPrinter.print_swagger(payload, title)
    DocWriter.new.write_docs(docs, title)
  end
end