trait JsonSchemaProviderSerializerTrait

Hierarchy

1 file declares its use of JsonSchemaProviderSerializerTrait
Serializer.php in core/modules/jsonapi/src/Serializer/Serializer.php

File

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

Namespace

Drupal\serialization\Serializer
View source
trait JsonSchemaProviderSerializerTrait {
    use SchematicNormalizerFallbackTrait;
    
    /**
     * {@inheritdoc}
     */
    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;
    }

}

Members


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