src/Normalizer/ConfigEntityNormalizer.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Normalizer/ConfigEntityNormalizer.php b/src/Normalizer/ConfigEntityNormalizer.php index 1e4e59c..ec5c760 100644 --- a/src/Normalizer/ConfigEntityNormalizer.php +++ b/src/Normalizer/ConfigEntityNormalizer.php @@ -40,6 +40,17 @@ class ConfigEntityNormalizer extends EntityNormalizer { $public_field_name = $resource_type->getPublicName($field_name); $enabled_public_fields[$public_field_name] = $field_value; } + + // JSON API resource identifier objects are sufficient to identify entities. + // By exposing all fields as attributes, we expose unwanted, confusing or + // duplicate information: + // - exposing an entity's ID (which is not a UUID) is bad + // - exposing its UUID as an attribute is useless (it's already part of the + // mandatory "id" attribute in JSON API) + // @see http://jsonapi.org/format/#document-resource-identifier-objects + unset($enabled_public_fields['id']); + unset($enabled_public_fields['uuid']); + return $enabled_public_fields; }