function SchematicNormalizerHelperTrait::getNormalizationSchema

Same name and namespace in other branches
  1. 11.x core/modules/serialization/src/Normalizer/SchematicNormalizerHelperTrait.php \Drupal\serialization\Normalizer\SchematicNormalizerHelperTrait::getNormalizationSchema()

Retrieve JSON Schema for the normalization.

Parameters

mixed $object: Supported object or class/interface name being normalized.

array $context: Context options. Well-defined keys include:

  • dialect: Used to specify a dialect for the desired schema being generated. The dialect meta-schema MUST extend JSON Schema draft 2020-12 or later. Normalizers MAY choose to return a schema with keywords supported by a dialect it supports, but only when they are supported by the dialect specified in this key. For instance, normalizers may return a schema with a 'discriminator' as supported by OpenAPI if that dialect is passed, but return a more permissive but less specific schema when it is not.

Return value

array JSON Schema for the normalization, conforming to version draft 2020-12.

See also

https://json-schema.org/specification#specification-documents

1 call to SchematicNormalizerHelperTrait::getNormalizationSchema()
DateTimeIso8601Normalizer::normalize in core/modules/serialization/src/Normalizer/DateTimeIso8601Normalizer.php
#[JsonSchema([ 'type' => 'string', 'format' => 'date', ])]
1 method overrides SchematicNormalizerHelperTrait::getNormalizationSchema()
SchematicNormalizerTrait::getNormalizationSchema in core/modules/serialization/src/Normalizer/SchematicNormalizerTrait.php
Retrieve JSON Schema for the normalization.

File

core/modules/serialization/src/Normalizer/SchematicNormalizerHelperTrait.php, line 35

Class

SchematicNormalizerHelperTrait
Methods for normalizing JSON schema.

Namespace

Drupal\serialization\Normalizer

Code

protected function getNormalizationSchema(mixed $object, array $context = []) : array {
  return $this->getJsonSchemaForMethod($this, 'normalize', [
    '$comment' => 'No schema available.',
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.