Exception: JSONSkooma::UnexpectedSchemaClassError

Inherits:
RegistryError show all
Defined in:
lib/json_skooma/registry.rb

Overview

Raised when a ref resolves to an object that is not the class the caller expected. Extension points (e.g. typed OpenAPI refs) can rescue this and load the subtree as the right class without matching on error message text.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, expected_class) ⇒ UnexpectedSchemaClassError

Returns a new instance of UnexpectedSchemaClassError.



12
13
14
15
16
# File 'lib/json_skooma/registry.rb', line 12

def initialize(uri, expected_class)
  @uri = uri
  @expected_class = expected_class
  super("The object referenced by #{uri} is not #{expected_class}")
end

Instance Attribute Details

#expected_classObject (readonly)

Returns the value of attribute expected_class.



10
11
12
# File 'lib/json_skooma/registry.rb', line 10

def expected_class
  @expected_class
end

#uriObject (readonly)

Returns the value of attribute uri.



10
11
12
# File 'lib/json_skooma/registry.rb', line 10

def uri
  @uri
end