You are here

protected function DataDefinitionTimestampNormalizer::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/DataDefinitionTimestampNormalizer.php, line 20

Class

DataDefinitionTimestampNormalizer
Data definition normalizer.

Namespace

Drupal\jsonapi_schema\Normalizer

Code

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