MediaWiki-extensions-CommunityConfiguration has a support for dynamicDefault, which allow to create a default for a schema using a callback, rather than as a PHP constant. This is occassionally needed to workaround PHP language limitations. For example, it is impossible to set an empty object as a default using the standard JsonSchema::DEFAULT approach, because:
self::DEFAULT => [ (object)[], ]
is not valid PHP code (Constant expression contains invalid operations).
To be able to use empty objects as JSON defaults, we would need support for dynamic defaults. Dynamic defaults would be also useful for conditional fallbacks.
Acceptance Criteria
- When JSON Schema specifies a dynamic default using a format understood by ReflectionSchemaSource (the dynamicDefault keyword), JsonSchemaBuilder evaluates the dynamic default.
- When both a dynamic and static default is specified, the dynamic default should take precedence.