Commit graph

6 commits

Author SHA1 Message Date
Umherirrender
fd516a98e1 Fix whitespaces after comma
Change-Id: Ide6de0a53661e6f650099d7b1f274a02699441df
2022-12-15 01:24:14 +01:00
daniel
f9b589f556 config-schema: Define types for all arrays.
This patch ensures that we know which arrays are lists (JsonSchema type
"array") and which are maps (JsonSchema type "object"). We can then
default to array_merge for lists and to array_plus for maps. This seems
clearer than requiring an explicit merge strategy to be declared for all
arrays.

This patch specified a mergeTrategy for some config variables that need
behavior different from the default.

This patch also changes the merging behavior to allow non-array values
to replace arrays and vice versa. It also changes the behavior of
defaults to allow falsy values to override non-falsy defaults.

Bug: T300129
Change-Id: Ia7b0c0250af6a957eac1efb554fb47511f5e093f
2022-02-23 14:09:41 +01:00
daniel
3ef1fdff8d SettingsBuilder: fix merging into globals
GlobalConfigBuilder needs to use the appropriate merge strategy to
combine new values with the value already rpesent in a global variable.
For this, GlobalConfigBuilder needs to actually look at the current
value of the global variable. Also, we need to define merge strategies
for all settings that need them (at least the ones used directly by
ExtensionProcessor).

Change-Id: I834d4b3506bdd8d416e5eb6e03fb4dd6b60b6e05
2022-01-24 17:35:15 +01:00
Petr Pchelko
2932c3c92f GlobalConfigSink: don't double-prefix in setDefault
$this->set was calling the overridden method, so if it was
called from setDefault, we'd end up double-prefixing the config.

Change-Id: I5f912332cc69cb58bb71e87cd9f8154246b53232
2021-11-30 14:03:11 +00:00
Petr Pchelko
f98f7312e1 SettingsBuilder: add ability to validate config against schema
Not yet sure if config validation makes sense in production,
possibly before we write into cache we can validate, and then
trust that the cached values are all valid. This patch just
adds ability to validate the configuration.

"justinrainbow/json-schema" is already a transitive dependency
and is already in vendor.

Change-Id: Ib039c897a36a7e1911309fd29514657042b1b139
2021-11-30 00:09:07 +00:00
Petr Pchelko
92f3f1a944 Introduce MergeStrategies for ConfigSink
Change-Id: Ibb4fdf83d87ad204da5fbc4892c9b7610e979f72
2021-11-16 13:07:03 -08:00