Skip to content
Snippets Groups Projects
Unverified Commit 65683671 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3516348 by bbrala, longwave, andypost, larowlan, jackfoust, mlubbers:...

Issue #3516348 by bbrala, longwave, andypost, larowlan, jackfoust, mlubbers: Allow 6.x version of justinrainbow/json-schema
parent 7d1a9ca9
Branches
Tags
5 merge requests!12628#3524738 backport without deprecation,!12477#3532243: JSON support status during updates,!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!213Issue #2906496: Give Media a menu item under Content
Pipeline #496070 passed with warnings
Pipeline: drupal

#496075

    ......@@ -4,7 +4,7 @@
    "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
    "This file is @generated automatically"
    ],
    "content-hash": "e359f7a4bb5e2c4520dd885d47b22963",
    "content-hash": "53d1316a007b7c509b5bda590321ed8f",
    "packages": [
    {
    "name": "asm89/stack-cors",
    ......
    ......@@ -12,7 +12,7 @@
    "colinodell/psr-testlogger": "^1.2",
    "composer/composer": "^2.8.1",
    "drupal/coder": "^8.3.10",
    "justinrainbow/json-schema": "^5.2",
    "justinrainbow/json-schema": "^5.2 || ^6.3",
    "lullabot/mink-selenium2-driver": "^1.7.3",
    "lullabot/php-webdriver": "^2.0.5",
    "mglaman/phpstan-drupal": "^1.2.11 || ^2.0.4",
    ......
    ......@@ -199,7 +199,9 @@ public function validateProps(array $context, Component $component): bool {
    $errors = array_filter(
    $this->validator->getErrors(),
    function (array $error) use ($context): bool {
    if (($error['constraint'] ?? '') !== 'type') {
    // Support 5.0 ($error['constraint']) and 6.0
    // ($error['constraint']['name']) at the same time.
    if (($error['constraint']['name'] ?? $error['constraint'] ?? '') !== 'type') {
    return TRUE;
    }
    return !Element::isRenderArray($context[$error['property']] ?? NULL);
    ......
    ......@@ -9,6 +9,7 @@
    use Drupal\Core\Theme\Component\ComponentValidator;
    use Drupal\Core\Render\Component\Exception\InvalidComponentException;
    use Drupal\Core\Plugin\Component;
    use JsonSchema\ConstraintError;
    use JsonSchema\Constraints\Factory;
    use JsonSchema\Constraints\FormatConstraint;
    use JsonSchema\Entity\JsonPointer;
    ......@@ -359,8 +360,14 @@ public function check(&$element, $schema = NULL, ?JsonPointer $path = NULL, $i =
    }
    if ($schema->format === 'uri') {
    if (\is_string($element) && !UrlHelper::isValid($element)) {
    if (class_exists(ConstraintError::class)) {
    $this->addError(ConstraintError::FORMAT_URL(), $path, ['format' => $schema->format]);
    }
    else {
    // @todo Remove when we no longer support justinrainbow/json-schema v5.
    $this->addError($path, 'Invalid URL format', 'format', ['format' => $schema->format]);
    }
    }
    return;
    }
    parent::check($element, $schema, $path, $i);
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment