summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/serialization/src/Serializer/JsonSchemaProviderSerializerInterface.php
blob: 162e393c85a164acf18e415d45fc206fd3fbe3bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php

declare(strict_types=1);

namespace Drupal\serialization\Serializer;

/**
 * Interface for JSON schema provider.
 */
interface JsonSchemaProviderSerializerInterface {

  /**
   * Convenience method to get a JSON schema.
   *
   * Unlike calling ::normalize() with $format of 'json_schema' directly, this
   * method always returns a schema, even if it's empty.
   *
   * @param mixed $object
   *   Object or interface/class name for which to retrieve a schema.
   * @param array $context
   *   Normalization context.
   *
   * @return array
   *   Schema.
   */
  public function getJsonSchema(mixed $object, array $context): array;

}