In the new generation of MediaWiki event schemas we want to restric the schemas to have monomorphic types everywhere, thus require that a certain property could only have a single possible type. The only place where it's not true right now is in the recentchange event - we allow the properties to be null. This is not consistent with the rest of the schemas, where null properties are just absent from the event. We need to make recentchange events conform to this bt clearing out the null properties.
The emitted events have already been modified to not include fields if their values are null, so we should be able to just remove the [..., null] polymorphic types in a new major schema version.
recentchange 1.0.0 also has the log_params field which has type: [array, object, string]. We should convert this to a map type like:
log_params: type: object additionalProperties: type: string
To do this, we need to modify EventBusRCFeedFormatter in the EventBus extension to ensure that log_params is always an object with string keys and string values. This can get a little tricky in PHP since there isn't a different between integer indexed arrays and string indexed 'objects'.
EventBusRCFeedFormatter should do the following if $attrs['log_params'] is set:
If $attrs['log_params'] is defined and...
- is_string: serialize as single element object with key of string "0": {"0": "value"}
- is integer indexed PHP array: serialize as string-integer indexed object: {"0": "value1", "1": "value2", ...}
- is associative indexed PHP array: serialize as string indexed object: {"key1": "value1", "key2", "value2", ...}
All values need to be properly converted into strings. I think strval will mostly work, but in order to convert booleans properly (e.g. true => "true", not "1"), we could perhaps just use FormatJson::encode($value, false, FormatJson::ALL_OK)?