Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModelReference type deserialization #169

Open
jkhsjdhjs opened this issue Nov 16, 2023 · 1 comment
Open

ModelReference type deserialization #169

jkhsjdhjs opened this issue Nov 16, 2023 · 1 comment
Labels
enhancement Enhancement of an existing feature sdk Something to do with the `sdk` package

Comments

@jkhsjdhjs
Copy link
Contributor

Currently, the type of a ModelReference is set as Referable for many attributes. Maybe it should be determined by checking the last key instead? The last key is currently only used to validate the type of a ModelReference, but not to determine it.

@s-heppner s-heppner added the enhancement Enhancement of an existing feature label Nov 21, 2023
@s-heppner s-heppner added the sdk Something to do with the `sdk` package label Nov 17, 2024
@s-heppner
Copy link
Contributor

I moved this text from #367:

In JSON, the, _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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of an existing feature sdk Something to do with the `sdk` package
Projects
None yet
Development

No branches or pull requests

2 participants