Class: SwaggerDocsGenerator::MetadataPath

Inherits:
MetadataController show all
Defined in:
lib/swagger_docs_generator/metadata/path.rb

Overview

# Metadata generated

Generate metadata for block paths in swagger specification

Instance Method Summary collapse

Constructor Details

#initializeMetadataPath

Returns a new instance of MetadataPath.



10
11
12
# File 'lib/swagger_docs_generator/metadata/path.rb', line 10

def initialize
  super
end

Instance Method Details

#construct_swagger_fileObject

Each controller parsed



15
16
17
18
19
20
21
22
# File 'lib/swagger_docs_generator/metadata/path.rb', line 15

def construct_swagger_file
  hash = {}
  controllers.each do |controller|
    file = File.join(path, "#{controller.controller_name}.json")
    hash.merge!(JSON.parse(File.read(file))['paths']) if File.exist?(file)
  end
  { paths: hash }
end