Commit 6c303a99 authored by Balint Pekker's avatar Balint Pekker Committed by Rich Gerdes
Browse files

Issue #3289485 - Fixed tests, changed dependency

parent 023f687e
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -35,13 +35,10 @@
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
      "drupal/core": "^8 || ^9"
    },
    "require-dev": {
        "drupal/coder": "^8.2",
        "drupal/hal": "^1 || ^2",
        "jakub-onderka/php-parallel-lint": "^0.9.2",
        "league/json-guard": "^1.0",
        "league/json-reference": "^1.0"
        "justinrainbow/json-schema": "^5.2"
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ name: Schemata
type: module
description: Provide schema definitions of Drupal entities for type validation, code generation, and documentation.
core: 8.x
core_version_requirement: '^8 || ^9'
core_version_requirement: '^8 || ^9 || ^10'
package: Web services
dependencies:
  - drupal:serialization
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ name: Schemata in JSON Schema
type: module
description: Provides a data models for entity types and bundles in JSON schema format.
core: 8.x
core_version_requirement: '^8 || ^9'
core_version_requirement: '^8 || ^9 || ^10'
package: Web services
dependencies:
  - schemata:schemata
+4 −4
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ class JsonSchemaEncoder extends JsonEncoder {
   * Create a JsonSchemaEncoder instance.
   *
   * @param \Symfony\Component\Serializer\Encoder\EncoderInterface $inner_encoder
   *   The encoder interface.
   *   The inner encoder.
   */
  public function __construct(EncoderInterface $inner_encoder) {
    parent::__construct();
@@ -40,14 +40,14 @@ class JsonSchemaEncoder extends JsonEncoder {
  /**
   * {@inheritdoc}
   */
  public function supportsEncoding($format) {
  public function supportsEncoding($format, array $context = []): bool {
    $parts = explode(':', $format, 2);

    if (count($parts) < 2 || empty($parts[1])) {
      // Require sub type.
      return FALSE;
    }
    list ($base, $encoded) = $parts;
    [$base, $encoded] = $parts;

    // Verify the correct base and that the sub type is supported by inner.
    return ($base === $this->baseFormat) && $this->innerEncoder->supportsEncoding($encoded);
@@ -56,7 +56,7 @@ class JsonSchemaEncoder extends JsonEncoder {
  /**
   * {@inheritdoc}
   */
  public function supportsDecoding($format) {
  public function supportsDecoding($format, array $context = []): bool {
    // We don't decode have a decoding system for json_schema.
    // @todo Implement conversion of json_schema to typed data.
    return FALSE;
+2 −3
Original line number Diff line number Diff line
@@ -58,14 +58,13 @@ class DataReferenceDefinitionNormalizer extends JsonDataReferenceDefinitionNorma
    // Collect data about the reference field.
    $parentProperty = $this->extractPropertyData($context['parent'], $context);
    $target_type = $entity->getConstraint('EntityType');
    $target_bundles = isset($context['settings']['handler_settings']['target_bundles']) ?
      $context['settings']['handler_settings']['target_bundles'] : [];
    $target_bundles = $context['settings']['handler_settings']['target_bundles'] ?? [];

    // Build the relation URI, which is used as the property key.
    $field_uri = $this->linkManager->getRelationUri(
      $context['entityTypeId'],
      // Drupal\Core\Entity\Entity::bundle() returns Entity Type ID by default.
      isset($context['bundleId']) ? $context['bundleId'] : $context['entityTypeId'],
      $context['bundleId'] ?? $context['entityTypeId'],
      $context['name'],
      $context
    );
Loading