Page MenuHomePhabricator

Provide Bespoke Validation for All Built-In Types in Normal Form
Closed, ResolvedPublic

Event Timeline

It should all follow from https://meta.wikimedia.org/wiki/Special:MyLanguage/Abstract_Wikipedia/Function_model and https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Pre-generic_function_model but I am pretty sure it does not. If helpful, ping me and I will provide a more specific list of conditions.
The built-in types are all the types between Z1 and Z99. Their respective validators are their ZID + 100, so the validator for Z14 is at Z114. The builtin implementation for that validator is at another +100, i.e. the builtin implementation for Z114 is at Z214.

Here are a few examples of validations:

  • Z10 must either have both keys, or none.
  • Z12 should have only one value for each language in its Z12K1
  • Z14 must have a Z14K1, and either a Z14K2, a Z14K3 or a Z14K4 (but only one of these, and not more than one)

There should be a generic validator (Z101) that checks:

  • whether all the keys on the object are defined on its Type
  • whether all the values for all the keys of the object resolve to the expected type defined for that key
  • calls the validator for all values for all the keys of the object recursively

A validator can choose to call the generic validator or not. For example, the validators for Z7 and Z99 will not call the generic validator, as they wouldn't pass.

I changed the title from canonical / short to normal / long / explicit.

DVrandecic renamed this task from Provide Bespoke Validation for All Built-In Types in Canonical Form to Provide Bespoke Validation for All Built-In Types in Normal Form.May 13 2021, 8:17 PM

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

[mediawiki/services/function-orchestrator@master] Provide Bespoke Validation for All Built-In Types in Normal Form

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

Change 694711 merged by jenkins-bot:

[mediawiki/services/function-orchestrator@master] Provide Bespoke Validation for All Built-In Types in Normal Form

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