Unverified Commit 4eb755b4 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

(cherry picked from commit 65683671)
parent a66d9a73
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,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",
+1 −1
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": "e359f7a4bb5e2c4520dd885d47b22963",
    "content-hash": "53d1316a007b7c509b5bda590321ed8f",
    "packages": [
        {
            "name": "asm89/stack-cors",
+1 −1
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.3",
        "lullabot/php-webdriver": "^2.0.5",
        "mglaman/phpstan-drupal": "^1.2.11 || ^2.0.4",
+3 −1
Original line number Diff line number Diff line
@@ -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);
+8 −1
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;
@@ -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);