Sha256: c10ab86735a98a490cf3e07b125451abdd9721f5a5ec75ec7c9dae68d0f9b015
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require "openapi3_parser/document" require "openapi3_parser/source_input/raw" require "openapi3_parser/source_input/file" require "openapi3_parser/source_input/url" module Openapi3Parser # For a variety of inputs this will construct an OpenAPI document. For a # String/File input it will try to determine if the input is JSON or YAML. # # @param [String, Hash, File] input Source for the OpenAPI document # # @return [Document] def self.load(input) Document.new(SourceInput::Raw.new(input)) end # For a given string filename this will read the file and parse it as an # OpenAPI document. It will try detect automatically whether the contents # are JSON or YAML. # # @param [String] path Filename of the OpenAPI document # # @return [Document] def self.load_file(path) Document.new(SourceInput::File.new(path)) end # For a given string URL this will request the resource and parse it as an # OpenAPI document. It will try detect automatically whether the contents # are JSON or YAML. # # @param [String] url URL of the OpenAPI document # # @return [Document] def self.load_url(url) Document.new(SourceInput::Url.new(url.to_s)) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
openapi3_parser-0.5.1 | lib/openapi3_parser.rb |
openapi3_parser-0.5.0 | lib/openapi3_parser.rb |
openapi3_parser-0.4.0 | lib/openapi3_parser.rb |
openapi3_parser-0.3.0 | lib/openapi3_parser.rb |