JsonSchemaReferenceResolver: Improve styling and docstring
Per feedback in I130326e5762e706be4889e308eeec45a6c7683c5. Bug: T357718 Change-Id: Ib1653daa0c374417f8aa4d00b5babb899bff94fa
This commit is contained in:
parent
e7c7d5210f
commit
8386426652
3 changed files with 14 additions and 3 deletions
|
|
@ -15,7 +15,8 @@ use InvalidArgumentException;
|
|||
class JsonSchemaReferenceResolver {
|
||||
/**
|
||||
* Traverse a JSON-schema to resolve all its referenced schemas ($ref)
|
||||
* and return them as an array of definitions ($defs)
|
||||
*
|
||||
* Result is returned via an output parameter $defs as an array of definitions.
|
||||
*
|
||||
* @param array $schema A valid JSON-schema
|
||||
* @param array &$defs Array reference that will be populated with the list of definitions (JSON-schemas)
|
||||
|
|
@ -36,8 +37,8 @@ class JsonSchemaReferenceResolver {
|
|||
* @param string $propertyName The name of the property the schema belongs to, used for error descriptions.
|
||||
* @param array &$defs Array reference that will be populated with the list of definitions (JSON-schemas)
|
||||
* referenced in the schema
|
||||
* @param array $traversedRefs Array to accumulate the already visited definitions for a given schema, used to
|
||||
* avoid loops in the reference resolution
|
||||
* @param array<string, bool> $traversedRefs Array to accumulate the already visited definitions
|
||||
* for a given schema, used to avoid loops in the reference resolution.
|
||||
*/
|
||||
private static function doGetDefinitions(
|
||||
array $schema,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ namespace MediaWiki\Settings\Source;
|
|||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Thrown when resolving references in a JSONSchema results in an infinite loop
|
||||
*
|
||||
* @since 1.42
|
||||
*/
|
||||
class RefLoopException extends RuntimeException {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,11 @@ namespace MediaWiki\Settings\Source;
|
|||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Thrown during processing a JSON Schema when a reference is not found
|
||||
*
|
||||
* @since 1.42
|
||||
*/
|
||||
class RefNotFoundException extends RuntimeException {
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue