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

Extended validation of models #53

Open
uniqueg opened this issue Feb 12, 2023 · 0 comments
Open

Extended validation of models #53

uniqueg opened this issue Feb 12, 2023 · 0 comments
Assignees
Milestone

Comments

@uniqueg
Copy link
Collaborator

uniqueg commented Feb 12, 2023

An extended Task validator tes.models.Task.is_valid() but not used directly by py-tes to validate a task. In principle, tasks could be easily autovalidated witht this method by calling it in a .__attrs_post_init__() method in the model definition. I'm just not quite sure if there is anything that speaks against it. If so, extended validation could also be made configurable (and, if necessary, be set to False for backwards compatibility).

Along the same lines, it might be nice to have such extended validation available for all models. Probably this could be done by defining an empty .is_valid() method in the Base class, together with a .__attrs_post_init__() method that calls it. The .is_valid() method could then be overridden by any model that requires extended validation.

Also, the .is_valid() could then be refactored to recursively validate nested models.

@uniqueg uniqueg self-assigned this Feb 12, 2023
@uniqueg uniqueg added this to the 1.0.0 milestone Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant