Currently, _construct_model_reference is very often called with the generic model.Referable as type_, instead of one of the more concret subclasses (e.g. model.Property).
This means, a model.ModelReference then has just the generic model.Referable as type attribute, leading to problems when trying to analyze the Reference further in the code.
I suggest to improve the calls of this deserialization function so that the actual type of the model object that the ModelReference points to is written to the ModelReference.type.
This issue was first noted in #337, where a hotfix is implemented, by inferering the type the ModelReference points to by using the last_key_type of the last Key in the References Keys.
Once this issue is solved, we should remove the then unnecessary hotfix from the _construct_model_reference method, that is marked with # TODO.
Currently,
_construct_model_referenceis very often called with the genericmodel.Referableastype_, instead of one of the more concret subclasses (e.g.model.Property).This means, a
model.ModelReferencethen has just the genericmodel.Referableastypeattribute, leading to problems when trying to analyze the Reference further in the code.I suggest to improve the calls of this deserialization function so that the actual type of the model object that the
ModelReferencepoints to is written to theModelReference.type.This issue was first noted in #337, where a hotfix is implemented, by inferering the type the
ModelReferencepoints to by using thelast_key_typeof the last Key in the ReferencesKeys.Once this issue is solved, we should remove the then unnecessary hotfix from the
_construct_model_referencemethod, that is marked with# TODO.