Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add links to documentation #634

Merged
merged 1 commit into from Jan 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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