You are here

protected function DataDefinitionEmailNormalizer::extractPropertyData in JSON:API Schema 8

Extracts property details from a data definition.

This method includes mapping primitive types in Drupal to JSON Schema type and format descriptions. This method is invoked by several of the normalizers.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $property: The data definition from which to extract values.

array $context: Serializer context.

Return value

array Discrete values of the property definition

Overrides DataDefinitionNormalizer::extractPropertyData

File

src/Normalizer/DataDefinitionEmailNormalizer.php, line 20

Class

DataDefinitionEmailNormalizer
Data definition normalizer.

Namespace

Drupal\jsonapi_schema\Normalizer

Code

protected function extractPropertyData(DataDefinitionInterface $property, array $context = []) {
  $value = parent::extractPropertyData($property);
  $value['type'] = 'string';
  $value['format'] = 'email';
  return $value;
}