You are here

protected function DataDefinitionNormalizer::requiredProperty in JSON:API Schema 8

Determine if the given property is a required element of the schema.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $property: The data property to be evaluated.

Return value

bool Whether the property should be treated as required for schema purposes.

2 calls to DataDefinitionNormalizer::requiredProperty()
DataDefinitionNormalizer::normalize in src/Normalizer/DataDefinitionNormalizer.php
ListDataDefinitionNormalizer::normalize in src/Normalizer/ListDataDefinitionNormalizer.php

File

src/Normalizer/DataDefinitionNormalizer.php, line 163

Class

DataDefinitionNormalizer
Normalizer for DataDefinitionInterface instances.

Namespace

Drupal\jsonapi_schema\Normalizer

Code

protected function requiredProperty(DataDefinitionInterface $property) {
  return $property
    ->isReadOnly() || $property
    ->isRequired();
}