Skip to content
Snippets Groups Projects

Issue #3390505: Error: uri is not a valid type for a JSON document

2 files
+ 31
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 27
0
<?php
namespace Drupal\jsonapi_schema\Normalizer;
use Drupal\Core\TypedData\DataDefinitionInterface;
/**
* Data definition normalizer.
*/
class DataDefinitionUriNormalizer extends DataDefinitionNormalizer {
/**
* {@inheritdoc}
*/
protected $supportedDataTypes = ['uri'];
/**
* {@inheritdoc}
*/
protected function extractPropertyData(DataDefinitionInterface $property, array $context = []) {
$value = parent::extractPropertyData($property);
$value['type'] = 'string';
$value['format'] = 'uri';
return $value;
}
}
Loading