Sha256: f62777e4e9402c1a7ca3a2e985012bb6e01980ac40d5237e356373663ebcd378

Contents?: true

Size: 450 Bytes

Versions: 1

Compression:

Stored size: 450 Bytes

Contents

require "openapi3_parser"
require "mountapi/open_api/path"

module Mountapi
  module OpenApi
    class Document
      attr_reader :spec

      def initialize(string)
        @spec = Openapi3Parser.load(string)
      end

      def routes
        spec.paths.inject([]) do |acc, path|
          acc.concat(Path.new(*path, version).to_routes)
        end
      end

      private

      def version
        spec.info.version
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mountapi-0.11.1 lib/mountapi/open_api/document.rb