Module: Openapi3Parser

Defined in:
lib/openapi3_parser.rb,
lib/openapi3_parser/error.rb,
lib/openapi3_parser/source.rb,
lib/openapi3_parser/version.rb,
lib/openapi3_parser/document.rb,
lib/openapi3_parser/markdown.rb,
lib/openapi3_parser/node/map.rb,
lib/openapi3_parser/node/tag.rb,
lib/openapi3_parser/node/xml.rb,
lib/openapi3_parser/node/info.rb,
lib/openapi3_parser/node/link.rb,
lib/openapi3_parser/node/array.rb,
lib/openapi3_parser/node/paths.rb,
lib/openapi3_parser/node/header.rb,
lib/openapi3_parser/node/object.rb,
lib/openapi3_parser/node/schema.rb,
lib/openapi3_parser/node/server.rb,
lib/openapi3_parser/cautious_dig.rb,
lib/openapi3_parser/node/contact.rb,
lib/openapi3_parser/node/context.rb,
lib/openapi3_parser/node/example.rb,
lib/openapi3_parser/node/license.rb,
lib/openapi3_parser/node/openapi.rb,
lib/openapi3_parser/node_factory.rb,
lib/openapi3_parser/source_input.rb,
lib/openapi3_parser/node/callback.rb,
lib/openapi3_parser/node/encoding.rb,
lib/openapi3_parser/node/response.rb,
lib/openapi3_parser/array_sentence.rb,
lib/openapi3_parser/node/operation.rb,
lib/openapi3_parser/node/parameter.rb,
lib/openapi3_parser/node/path_item.rb,
lib/openapi3_parser/node/responses.rb,
lib/openapi3_parser/source/pointer.rb,
lib/openapi3_parser/validators/url.rb,
lib/openapi3_parser/node/components.rb,
lib/openapi3_parser/node/media_type.rb,
lib/openapi3_parser/node/oauth_flow.rb,
lib/openapi3_parser/source/location.rb,
lib/openapi3_parser/node/oauth_flows.rb,
lib/openapi3_parser/node/placeholder.rb,
lib/openapi3_parser/node_factory/map.rb,
lib/openapi3_parser/node_factory/tag.rb,
lib/openapi3_parser/node_factory/xml.rb,
lib/openapi3_parser/source/reference.rb,
lib/openapi3_parser/source_input/raw.rb,
lib/openapi3_parser/source_input/url.rb,
lib/openapi3_parser/validation/error.rb,
lib/openapi3_parser/validators/email.rb,
lib/openapi3_parser/node/request_body.rb,
lib/openapi3_parser/node_factory/info.rb,
lib/openapi3_parser/node_factory/link.rb,
lib/openapi3_parser/source_input/file.rb,
lib/openapi3_parser/node/discriminator.rb,
lib/openapi3_parser/node_factory/array.rb,
lib/openapi3_parser/node_factory/field.rb,
lib/openapi3_parser/node_factory/paths.rb,
lib/openapi3_parser/node/parameter_like.rb,
lib/openapi3_parser/node_factory/header.rb,
lib/openapi3_parser/node_factory/object.rb,
lib/openapi3_parser/node_factory/schema.rb,
lib/openapi3_parser/node_factory/server.rb,
lib/openapi3_parser/node/security_scheme.rb,
lib/openapi3_parser/node/server_variable.rb,
lib/openapi3_parser/node_factory/contact.rb,
lib/openapi3_parser/node_factory/context.rb,
lib/openapi3_parser/node_factory/example.rb,
lib/openapi3_parser/node_factory/license.rb,
lib/openapi3_parser/node_factory/openapi.rb,
lib/openapi3_parser/validators/reference.rb,
lib/openapi3_parser/node_factory/callback.rb,
lib/openapi3_parser/node_factory/encoding.rb,
lib/openapi3_parser/node_factory/response.rb,
lib/openapi3_parser/validators/media_type.rb,
lib/openapi3_parser/node_factory/operation.rb,
lib/openapi3_parser/node_factory/parameter.rb,
lib/openapi3_parser/node_factory/path_item.rb,
lib/openapi3_parser/node_factory/reference.rb,
lib/openapi3_parser/node_factory/responses.rb,
lib/openapi3_parser/validation/validatable.rb,
lib/openapi3_parser/node_factory/components.rb,
lib/openapi3_parser/node_factory/media_type.rb,
lib/openapi3_parser/node_factory/oauth_flow.rb,
lib/openapi3_parser/validators/absolute_uri.rb,
lib/openapi3_parser/node_factory/oauth_flows.rb,
lib/openapi3_parser/node/security_requirement.rb,
lib/openapi3_parser/node_factory/request_body.rb,
lib/openapi3_parser/node_factory/type_checker.rb,
lib/openapi3_parser/source/resolved_reference.rb,
lib/openapi3_parser/source_input/resolve_next.rb,
lib/openapi3_parser/validators/component_keys.rb,
lib/openapi3_parser/node_factory/discriminator.rb,
lib/openapi3_parser/source_input/string_parser.rb,
lib/openapi3_parser/validation/input_validator.rb,
lib/openapi3_parser/validators/required_fields.rb,
lib/openapi3_parser/document/reference_registry.rb,
lib/openapi3_parser/node/external_documentation.rb,
lib/openapi3_parser/node_factory/parameter_like.rb,
lib/openapi3_parser/validation/error_collection.rb,
lib/openapi3_parser/node_factory/security_scheme.rb,
lib/openapi3_parser/node_factory/server_variable.rb,
lib/openapi3_parser/validators/unexpected_fields.rb,
lib/openapi3_parser/node_factory/fields/reference.rb,
lib/openapi3_parser/node_factory/object_factory/dsl.rb,
lib/openapi3_parser/node_factory/optional_reference.rb,
lib/openapi3_parser/validators/duplicate_parameters.rb,
lib/openapi3_parser/node_factory/security_requirement.rb,
lib/openapi3_parser/node_factory/external_documentation.rb,
lib/openapi3_parser/validators/mutually_exclusive_fields.rb,
lib/openapi3_parser/node_factory/object_factory/validator.rb,
lib/openapi3_parser/node_factory/object_factory/field_config.rb,
lib/openapi3_parser/node_factory/object_factory/node_builder.rb

Defined Under Namespace

Modules: ArraySentence, Markdown, Node, NodeFactory, Validation, Validators Classes: CautiousDig, Document, Error, Source, SourceInput

Constant Summary collapse

VERSION =
"0.10.0"

Class Method Summary collapse

Class Method Details

.load(input) ⇒ Document

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.

Parameters:

  • input (String, Hash, File)

    Source for the OpenAPI document

Returns:



13
14
15
# File 'lib/openapi3_parser.rb', line 13

def self.load(input)
  Document.new(SourceInput::Raw.new(input))
end

.load_file(path) ⇒ Document

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.

Parameters:

  • path (String)

    Filename of the OpenAPI document

Returns:



24
25
26
# File 'lib/openapi3_parser.rb', line 24

def self.load_file(path)
  Document.new(SourceInput::File.new(path))
end

.load_url(url) ⇒ Document

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.

Parameters:

  • url (String)

    URL of the OpenAPI document

Returns:



35
36
37
# File 'lib/openapi3_parser.rb', line 35

def self.load_url(url)
  Document.new(SourceInput::Url.new(url.to_s))
end