Unverified Commit f6a31492 authored by Alex Pott's avatar Alex Pott
Browse files

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

Issue #3516348 by bbrala, andypost, longwave, larowlan, jackfoust, mlubbers: Allow 6.x version of justinrainbow/json-schema
parent d1e3c80b
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for composer.json: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -20,7 +20,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",
        "lullabot/php-webdriver": "^2.0.4",
        "mglaman/phpstan-drupal": "^1.2.12",
+1 −1
Changes for composer.lock: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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": "38510ee3fa6d0ddb39c85b7172e095fc",
    "content-hash": "4c1d292a8a8199682b920af13dd37ab2",
    "packages": [
        {
            "name": "asm89/stack-cors",
+1 −1
Changes for composer/Metapackage/DevDependencies/composer.json: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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",
        "lullabot/php-webdriver": "^2.0.4",
        "mglaman/phpstan-drupal": "^1.2.12",
+3 −1
Changes for core/lib/Drupal/Core/Theme/Component/ComponentValidator.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -177,7 +177,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);
+7 −0
Changes for core/tests/Drupal/Tests/Core/Theme/Component/ComponentValidatorTest.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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;
@@ -279,8 +280,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);