Page MenuHomePhabricator

Use evaluation for validation
Open, MediumPublic

Description

Every type will come with a function that validates the instances of that type. These functions are functions defined in Wikifunctions. This task is to actually use these functions to validate instances.

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
OpenNone
OpenNone
DuplicateNone
OpenNone
OpenNone
OpenNone
OpenNone
Resolvedcmassaro
ResolvedDVrandecic
ResolvedLindsaykwardell
Resolvedarthurlorenzi
ResolvedNone
InvalidNone
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
ResolvedJdforrester-WMF
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
ResolvedNone

Event Timeline

DVrandecic triaged this task as Medium priority.Apr 7 2021, 5:08 AM

I’m wondering whether it would make sense to think of a Z4K3/validator (function) as a constructor for validated instances of objects of the specified type. In practice, this would add an additional key into validated instances, with its value being the list of Z5/Errors (an empty list in the case of a valid object). For example, the valid positive integer represented by "2" would be the object {"Z1K1": "Z70", "Z70K1": "2", "Z70K2": []}. The unvalidated instance, on the other hand, would be a Z7/Function call to the Z70 validator/constructor function, passing "K1": "2" (and expecting type+value+errors – a validated Z70 instance – in return). This ensures that only the validator/constructor function can provide the Z70K2/errors value.