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

Rename property attribute @ref to ref? #595

Open
jesper-friis opened this issue Aug 14, 2023 · 0 comments
Open

Rename property attribute @ref to ref? #595

jesper-friis opened this issue Aug 14, 2023 · 0 comments
Labels
question Further information is requested

Comments

@jesper-friis
Copy link
Collaborator

jesper-friis commented Aug 14, 2023

When representing DLite properties with Python dataclasses or pydantic models, the @ref attribute create some trouble since it is not a valid Python identifier. Although pydantic v2 support aliases, it is an unnecessary complication and it is not supported in dataclasses, pydantic v1 and other similar framework.

The simplest solution is simply renaming the attribute from @ref to ref.

Are the any good reasons not to do so?

For backward compatibility, we could keep support for @ref in the json parser and instance_from_dict() for a while together with a deprecation warning.

@jesper-friis jesper-friis added the question Further information is requested label Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant