def resolve_reference(path, parent = nil)
      obj = get_object(path)
      ref = obj[REF_KEY]

      # TODO: merge parent and obj into obj (destructive)

      # If we find an immediate reference, chase it and pass the immediate
      # object as a parent.
      return resolve_reference_string(ref) if ref

      # If we are dealing with an object, encode it's class name into the
      # schema and generate it's model if necessary.
      if include_type?(obj, OBJECT_TYPE) && obj[PROPERTIES_KEY]
        obj[DERIVED_NAME] = class_name_from_path(@class_prefix, path, @schema)
        generate(path, obj[DERIVED_NAME]) unless @models.has_key?(obj[DERIVED_NAME])
      end

      obj
    end
def resolve_reference(path, parent = nil)
      obj = get_object(path)
      ref = obj[REF_KEY]

      # TODO: merge parent and obj into obj (destructive)

      # If we find an immediate reference, chase it and pass the immediate
      # object as a parent.
      return resolve_reference_string(ref) if ref

      # If we are dealing with an object, encode it's class name into the
      # schema and generate it's model if necessary.
      if include_type?(obj, OBJECT_TYPE) && obj[PROPERTIES_KEY]
        obj[DERIVED_NAME] = class_name_from_path(@class_prefix, path, @schema)
        generate(path, obj[DERIVED_NAME]) unless @models.has_key?(obj[DERIVED_NAME])
      end

      obj
    end
Given a path, which could be at any part of a reference chain, resolve
 the immediate schema object. This means:

 - if there is an imediate ref, follow it
 - inherit any schema information from the parent reference chain
 (unimplemented)

 If we are at the end of a chain, do the following:

 - generate a model for this object if necessary
 - add `class_name` to the immediate object when appropriate
 - return the immediate object

 @param path [Array] the path to an object in the schema
 @param parent [Hash, nil] the merged attributes of the parent reference chain
 @return [Hash] a modified schema object with inherited attributes from
 it's parents.