Skip to content

json_deserialization: _construct_model_reference is called with generic model.Referable type #367

@s-heppner

Description

@s-heppner

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existsenhancementEnhancement of an existing featuresdkSomething to do with the `sdk` package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions