Skip to content

Commit

Permalink
Merge pull request #634 from ergebnis/feature/links
Browse files Browse the repository at this point in the history
Enhancement: Add links to documentation
  • Loading branch information
localheinz committed Jan 21, 2022
2 parents 3658b93 + a9c8d17 commit e22e3d6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/SchemaNormalizer.php
Expand Up @@ -131,10 +131,16 @@ private function normalizeArray(
$schema,
);

/**
* @see https://json-schema.org/understanding-json-schema/reference/array.html
*/
if (!self::describesType('array', $schema)) {
return $data;
}

/**
* @see https://json-schema.org/understanding-json-schema/reference/array.html#items
*/
if (!\property_exists($schema, 'items')) {
return $data;
}
Expand Down Expand Up @@ -173,10 +179,16 @@ private function normalizeObject(
$schema,
);

/**
* @see https://json-schema.org/understanding-json-schema/reference/object.html
*/
if (!self::describesType('object', $schema)) {
return $data;
}

/**
* @see https://json-schema.org/understanding-json-schema/reference/object.html#properties
*/
if (!\property_exists($schema, 'properties')) {
return $data;
}
Expand Down Expand Up @@ -287,6 +299,9 @@ private function resolveSchema(
return $schema;
}

/**
* @see https://json-schema.org/understanding-json-schema/reference/type.html
*/
private static function describesType(
string $type,
\stdClass $schema
Expand Down

0 comments on commit e22e3d6

Please sign in to comment.