While adding support for schema references in ReflectionSchemaSource for the MediaWiki-extensions-CommunityConfiguration project an ad-hoc "reference object" (it's actually a PHP associative array) was created to support referencing a schema living in a PHP class from another class. eg:
class ExampleSchema extends JsonSchema { public const CCExamplePageTitle = [ self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ] ]; }
While this approach is valuable for the MediaWiki-extensions-CommunityConfiguration, it was brought (in code review comments), that JSON-schema references can and usually have a different shape, commonly a string with an absolute or relative URI pointing to the referenced schema. eg:
class ExampleSchema extends JsonSchema { public const CCExamplePageTitleInternal = [ // Internal ref self::REF => 'src/schemas/mediawiki.pagetitle.schema.json' ]; public const CCExamplePageTitleExternal = [ // External ref self::REF => 'https://example.com/mediawiki.schema.json' ]; }
This work could be helpful for the implementation of T358560: Rest: Deprecate BodyValidator . The task is to clarify what kind of references need to be supported and provide such support.
Notes:
Related code review comments