Method: JSONModelType.type_of

Defined in:
lib/aspace_client/jsonmodel_type.rb

.type_of(path) ⇒ Object

Return the type of the schema property defined by ‘path’

For example, type_of(“names/items/type”) might return a JSONModel class



162
163
164
165
166
167
168
169
170
171
172
# File 'lib/aspace_client/jsonmodel_type.rb', line 162

def self.type_of(path)
  type = JSONSchemaUtils.schema_path_lookup(self.schema, path)["type"]

  ref = JSONModel.parse_jsonmodel_ref(type)

  if ref
    JSONModel.JSONModel(ref.first)
  else
    Kernel.const_get(type.capitalize)
  end
end