Sha256: c244b1a72e06a6a87cc52b363737752954419d8f29b161c31eb89b0d2060b4bb

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

module SwaggerDocsGenerator
  # # Metadata generated
  #
  # Generate metadata for block paths in swagger specification
  #
  # @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#pathsObject
  class MetadataPath < MetadataController
    def initialize
      super
    end

    # Each controller parsed
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
swagger_docs_generator-0.1.1 lib/swagger_docs_generator/metadata/path.rb
swagger_docs_generator-0.1.0 lib/swagger_docs_generator/metadata/path.rb