Page MenuHomePhabricator

Community configuration: Write specifications for the schema provider
Closed, ResolvedPublic

Description

This task serves to define how should the Schema provider component of Community configuration 2.0 project work like. For a high-level technical overview of Community configuration 2.0 (including description of other components), please see T341884: Community configuration: Define architecture of the system. This task assumes high-level familiarity with other components the feature is consisted of.

Description

In Community configuration 1.0 used by Growth, the validation is very loose and primarily based on a custom datatype validation method, which ensures all fields are of the right data type. This ensures the site doesn't go down by trying to work with an integer when it really expects an array, but it doesn't help with much more. In an ideal world, how each configuration page looks like would be specified by a formal schema, such as JSON schema.

The schema provider is responsible for ensuring each configuration page has such a formal schema defined, validating that each configuration page follows the rules specified in said schema and for a transforming API making it easier for users to make incompatible changes to the schema.

Schema storage

Schema storage is responsible for fetching the right schema for each configuration page. Schema for each configuration page is either stored in the source version control system (if it is for core/extension/skin). Gadgets (or other configuration-definers outside of MediaWiki) will not be supported in the MVP. We will use JSONSchema to formally describe each configuration page.

Validation layer

Fetches the right schema for a given Title from the schema store and ensures a given PHP object meets said schema. This should be delegated to the greatest possible extend to an appropriate external library. A research spike for validation options is filled as T332847: [Spike] Investigate JSON structure validation options for community configuration; this section should be expanded once said spike finishes.

Migration layer

TODO

Open questions
  • Where should config schema live for gadgets? Is a special MCR slot a good place?
  • Related to previous: Should there be a support for "schema for this page is the same as this page from XYZ wiki"?
  • ...

Event Timeline

With T344144 being resolved, the first description of schemas in CC2.0 is created and published. Follow-up work to be tracked elsewhere.