Class: Openapi3Parser::SourceInput
- Inherits:
-
Object
- Object
- Openapi3Parser::SourceInput
- Defined in:
- lib/openapi3_parser/source_input.rb,
lib/openapi3_parser/source_input/raw.rb,
lib/openapi3_parser/source_input/url.rb,
lib/openapi3_parser/source_input/file.rb,
lib/openapi3_parser/source_input/resolve_next.rb,
lib/openapi3_parser/source_input/string_parser.rb
Overview
An abstract class which is used to provide a foundation for classes that represent the different means of input an OpenAPI document can have. It is used to represent the underlying source of the data which is used as a source within an OpenAPI document.
Defined Under Namespace
Classes: File, Raw, ResolveNext, StringParser, Url
Instance Attribute Summary collapse
-
#access_error ⇒ Error::InaccessibleInput?
readonly
The current value of access_error.
-
#parse_error ⇒ Error::UnparsableInput?
readonly
The current value of parse_error.
Instance Method Summary collapse
-
#==(_other) ⇒ Object
Used to determine whether a different instance of SourceInput is the same file/data.
-
#available? ⇒ Boolean
Indicates that the data within this input is suitable (i.e. can parse underlying JSON or YAML) for trying to use as part of a Document.
-
#contents ⇒ Object
The parsed data from the input.
-
#relative_to(_source_input) ⇒ String
The relative path, if possible, for this source_input compared to a different one.
-
#resolve_next(_reference) ⇒ Object
For a given reference use the context of the current SourceInput to determine which file is required for the reference.
Instance Attribute Details
#access_error ⇒ Error::InaccessibleInput? (readonly)
Returns the current value of access_error.
22 23 24 |
# File 'lib/openapi3_parser/source_input.rb', line 22 def access_error @access_error end |
#parse_error ⇒ Error::UnparsableInput? (readonly)
Returns the current value of parse_error.
22 23 24 |
# File 'lib/openapi3_parser/source_input.rb', line 22 def parse_error @parse_error end |
Instance Method Details
#==(_other) ⇒ Object
Used to determine whether a different instance of SourceInput is the same file/data
39 |
# File 'lib/openapi3_parser/source_input.rb', line 39 def ==(_other); end |
#available? ⇒ Boolean
Indicates that the data within this input is suitable (i.e. can parse underlying JSON or YAML) for trying to use as part of a Document
27 28 29 |
# File 'lib/openapi3_parser/source_input.rb', line 27 def available? access_error.nil? && parse_error.nil? end |
#contents ⇒ Object
The parsed data from the input
47 48 49 50 51 |
# File 'lib/openapi3_parser/source_input.rb', line 47 def contents raise access_error if access_error raise parse_error if parse_error @contents end |
#relative_to(_source_input) ⇒ String
The relative path, if possible, for this source_input compared to a different one. Defaults to empty string and should be specialised in subclasses
58 59 60 |
# File 'lib/openapi3_parser/source_input.rb', line 58 def relative_to(_source_input) "" end |
#resolve_next(_reference) ⇒ Object
For a given reference use the context of the current SourceInput to determine which file is required for the reference. This allows references to use relative file paths because we can combine them witt the current SourceInput location to determine the next one
35 |
# File 'lib/openapi3_parser/source_input.rb', line 35 def resolve_next(_reference); end |