function JsonSchemaProviderSerializerTrait::getJsonSchema

File

core/modules/serialization/src/Serializer/JsonSchemaProviderSerializerTrait.php, line 17

Class

JsonSchemaProviderSerializerTrait

Namespace

Drupal\serialization\Serializer

Code

public function getJsonSchema(mixed $object, array $context) : array {
    try {
        $normalizer_schema = $this->normalize($object, 'json_schema', $context);
    } catch (NotNormalizableValueException) {
        $normalizer_schema = [
            '$comment' => static::generateNoSchemaAvailableMessage($object),
        ];
    }
    return $normalizer_schema;
}

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