Commit graph

2 commits

Author SHA1 Message Date
Martin Urbanec
8386426652 JsonSchemaReferenceResolver: Improve styling and docstring
Per feedback in I130326e5762e706be4889e308eeec45a6c7683c5.

Bug: T357718
Change-Id: Ib1653daa0c374417f8aa4d00b5babb899bff94fa
2024-04-05 23:26:01 +02:00
Sergio Gimeno
50a966a208 ReflectionSchemaSource: add support for JSON schema $refs
Why: supporting JSON schema $refs is desired for the
CommunityConfiguration 2.0 project so configuration
schemas can reuse definitions coming from another
PHP JsonSchema class. The https://json-schema.org/
specification supports relative and absolute URIs
as the content of a $ref. The change aims
to support only the former. Meaning that any
$ref defined in a schema should point to a
class that can be resolved by PHP.

What: update schema traversing in JsonSchemaTrait
to resolve any reference specified as:
[ 'class' => SomeClass:class, 'field' => 'someClassField' ]
into an actual json schema compliant $ref, eg:
$ref: '#/$defs/SomeDefinitionName'. Also annotate
new definitions found in a "$defs" array with the
resolved value of the refed class field.

Bug: T357718
Change-Id: I130326e5762e706be4889e308eeec45a6c7683c5
2024-04-05 13:18:47 +02:00