Page MenuHomePhabricator

Function model: Change the signature of validators from Type -> List to Type -> Type (pass-through)
Closed, ResolvedPublic

Description

This is done when:

  • Definitions changed in function-schemata.
  • Validation schema changed in function-schemata.
  • Orchestrator (and its built-in validators) changed over.

The suggestion is to change the signature of validators from taking the type being validated and returning a list of errors to taking a type and returning the same type. A validator would return a valid value unchanged, whereas in the case of an invalid value it would raise errors (an error representing a list of errors, if needed).

This has the following advantages:

  • We have more control about when to validate in compositions. There are some functions, such as Z808/abstract, which create objects that might potentially have issues. By being able to use validation like a pipe, we can use it freely in implementations and capture errors sooner. Otherwise the orchestrator might need to use validators more frequently than really needed.
  • Returning errors might be difficult and become even more difficult with the changes to the error system. By pushing the errors to the error value, they become easier to handle.
  • It becomes easier to pipe validators together with other calls in all kind of circumstances.

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
StalledNone
Resolvedcmassaro
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
DuplicateNone
OpenNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedNone
ResolvedSimoneThisDot
Resolvedcmassaro
Resolvedcmassaro
Resolvedcmassaro
ResolvedNone
ResolvedDVrandecic
Resolvedcmassaro
OpenNone
Resolvedarthurlorenzi

Event Timeline

Jdforrester-WMF renamed this task from Change validator signature from T -> List to T -> T (to discuss) to Function model: Consider changing the signature of validators from T -> List to T -> T.Sep 3 2021, 6:14 PM
Jdforrester-WMF renamed this task from Function model: Consider changing the signature of validators from T -> List to T -> T to Function model: Consider changing the signature of validators from Type -> List to Type -> Type (pass-through).Sep 8 2021, 4:34 PM
DVrandecic renamed this task from Function model: Consider changing the signature of validators from Type -> List to Type -> Type (pass-through) to Function model: Change the signature of validators from Type -> List to Type -> Type (pass-through).Oct 6 2021, 4:44 PM

Change 732106 had a related patch set uploaded (by DVrandecic; author: DVrandecic):

[mediawiki/services/function-schemata@master] Change validators to pass through the validated object

https://gerrit.wikimedia.org/r/732106

Change 732106 merged by jenkins-bot:

[mediawiki/services/function-schemata@master] definitions: Change validators to pass through the validated object

https://gerrit.wikimedia.org/r/732106

The change has happened in the function-schemata. Next up, this needs to be changed in the orchestrator.

Change 732049 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] Update function-schemata sub-module to HEAD (bc54941)

https://gerrit.wikimedia.org/r/732049

Change 733073 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/services/function-evaluator@master] Update function-schemata sub-module to HEAD (bc54941)

https://gerrit.wikimedia.org/r/733073

Change 732048 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/services/function-evaluator@master] Update function-schemata sub-module to HEAD (bc54941)

https://gerrit.wikimedia.org/r/732048

Change 732047 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/services/function-orchestrator@master] Update function-schemata sub-module to HEAD (bc54941)

https://gerrit.wikimedia.org/r/732047

Change 733073 abandoned by Jforrester:

[mediawiki/services/function-evaluator@master] Update function-schemata sub-module to HEAD (bc54941)

Reason:

https://gerrit.wikimedia.org/r/733073

Change 732048 merged by jenkins-bot:

[mediawiki/services/function-evaluator@master] Update function-schemata sub-module to HEAD (bc54941)

https://gerrit.wikimedia.org/r/732048

Change 732047 merged by jenkins-bot:

[mediawiki/services/function-orchestrator@master] Update function-schemata sub-module to HEAD (bc54941)

https://gerrit.wikimedia.org/r/732047

Change 732049 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Update function-schemata sub-module to HEAD (bc54941)

https://gerrit.wikimedia.org/r/732049

Change 753443 had a related patch set uploaded (by Arthur Lorenzi; author: Arthur Lorenzi):

[mediawiki/services/function-orchestrator@master] Change the signature of validators from Type -> List to Type -> Type

https://gerrit.wikimedia.org/r/753443

Change 753443 merged by jenkins-bot:

[mediawiki/services/function-orchestrator@master] Change the signature of validators from Type -> List to Type -> Type

https://gerrit.wikimedia.org/r/753443