Class: SchemaTest::Property::UnresolvedProperty

Inherits:
Object show all
Defined in:
lib/schema_test/property.rb

Constant Summary

Constants inherited from Object

Object::SHORTHAND_ATTRIBUTES, Object::TYPES

Constants inherited from SchemaTest::Property

NULL_TYPE

Instance Attribute Summary

Attributes inherited from Object

#excluded_property_names, #version

Attributes inherited from SchemaTest::Property

#_type, #description, #name

Instance Method Summary collapse

Methods inherited from Object

#array, #as_json_schema, #base_json_schema_type, #based_on, #object

Methods inherited from SchemaTest::Property

#as_json_schema, #base_json_schema_type, #json_schema_format, #json_schema_type, #lookup_object, #nullable, #nullable!, #nullable?, #optional, #optional!, #optional?, #type

Constructor Details

#initialize(name, versions:) ⇒ UnresolvedProperty

Returns a new instance of UnresolvedProperty.



267
268
269
270
# File 'lib/schema_test/property.rb', line 267

def initialize(name, versions:)
  @name = name
  @versions = versions
end

Instance Method Details

#==(other) ⇒ Object



280
281
282
# File 'lib/schema_test/property.rb', line 280

def ==(other)
  resolve == other
end

#propertiesObject



284
285
286
# File 'lib/schema_test/property.rb', line 284

def properties
  resolve.properties
end

#resolveObject

Raises:



272
273
274
275
276
277
278
# File 'lib/schema_test/property.rb', line 272

def resolve
  @versions.each do |v|
    definition = SchemaTest::Definition.find(@name, v)
    return definition if definition
  end
  raise SchemaTest::Error, "could not resolve schema #{@name.inspect}; tried versions: #{@versions.inspect}"
end