MediaWiki-extensions-CommunityConfiguration validates all configuration against a JSON schema. Validation happens in two cases:
- before writing new configuration (to ensure users cannot write invalid configuration),
- before returning configuration from the store (so that client extensions can rely on the configuration being valid, even in case of store hiccups)
Sometimes, enforcing all validation rules are met in 100% of cases is not welcomed. For example, implementing a schema migration system (T357532) requires schema changes to be backwards and forwards compatible (this is because it is not possible to hook into train deployment/rollbacks, and immediately follow them by a maintenance script which migrates the config; for this reason, there will be always at least a couple of hours in which the version of the schema and of the data is different). A similar example is T359193: Community configuration: Decide whether the schema PHP classes need support for `required` and fresh deployment of MediaWiki-extensions-CommunityConfiguration – in that case, the configuration pages do not exist yet, and as such, configuration that has all required fields cannot be returned.
To support those cases, we should categorise validation issues into two categories: validation errors and validation warnings. CommunityConfiguration (or to be more precise, IConfigurationProvider::storeValidConfiguration) should refuse to write configuration that results in either a validation error or a validation warning.
On the other hand, CommunityConfiguration (IConfigurationProvider::loadValidConfiguration) should refuse to return configuration that contains a validation error, but it should return configuration when it has a validation warning (it should still inform the warning is present, but the configuration should be returned regardless).
Unless explicitly defined otherwise, any validation issue should be considered a validation error (in other words, unless defined otherwise, validation issues are blocking for both writes and reads).
List of validation warnings
- A property is marked as required, but it is not present in the data
- Schema disallows additional properties, but one is present
Acceptance Criteria
- When a configuration store contains a validation warning (see above), IConfigurationStore::loadValidConfiguration() returns that configuration, but informs about the warning in an appropriate manner (directly to the caller, or to Logstash, or in an alternative manner)
- When a configuration store contains any other validation issue (that is not explicitly listed as a warning), IConfigurationStore::loadValidConfiguration() returns a fatal error and refuses to return the configuration
- When any validation issue is present, IConfigurationStore::storeValidConfiguration refuses to write the invalid data
- When a configuration store contains a validation warning, Special:CommunityConfiguration loads the config properly, and allows changes to be made.
- When a configuration store contains a validation error, Special:CommunityConfiguration fails to load with a validation error.