class Openapi3Parser::Source::ResolvedReference
Attributes
object_type[R]
reference_registry[R]
source_location[R]
Public Class Methods
new(source_location:, object_type:, reference_registry:)
click to toggle source
# File lib/openapi3_parser/source/resolved_reference.rb, line 15 def initialize(source_location:, object_type:, reference_registry:) @source_location = source_location @object_type = object_type @reference_registry = reference_registry end
Public Instance Methods
errors()
click to toggle source
# File lib/openapi3_parser/source/resolved_reference.rb, line 27 def errors @errors ||= Array(build_errors) end
factory()
click to toggle source
# File lib/openapi3_parser/source/resolved_reference.rb, line 31 def factory @factory ||= begin reference_registry .factory(object_type, source_location) .tap do |factory| message = "Unregistered node factory at #{source_location}" raise Openapi3Parser::Error, message unless factory end end end
valid?()
click to toggle source
# File lib/openapi3_parser/source/resolved_reference.rb, line 23 def valid? errors.empty? end
Private Instance Methods
build_errors()
click to toggle source
# File lib/openapi3_parser/source/resolved_reference.rb, line 46 def build_errors return source_unavailabe_error unless source.available? return pointer_missing_error unless source_location.pointer_defined? resolution_error unless factory.valid? end
pointer_missing_error()
click to toggle source
# File lib/openapi3_parser/source/resolved_reference.rb, line 57 def pointer_missing_error suffix = source.root? ? "" : " in source #{source.relative_to_root}" "#{source_location.pointer} is not defined#{suffix}" end
resolution_error()
click to toggle source
# File lib/openapi3_parser/source/resolved_reference.rb, line 62 def resolution_error "#{source_location} does not resolve to a valid object" end