src/Normalizer/NormalizerBase.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Normalizer/NormalizerBase.php b/src/Normalizer/NormalizerBase.php index 14b1a5a..709739c 100644 --- a/src/Normalizer/NormalizerBase.php +++ b/src/Normalizer/NormalizerBase.php @@ -16,4 +16,15 @@ abstract class NormalizerBase extends SerializationNormalizerBase { */ protected $format = 'api_json'; + /** + * {@inheritdoc} + */ + protected function checkFormat($format = NULL) { + // The parent implementation allows format-specific normalizers to be used + // for formatless normalization. The JSON:API module wants to be cautious. + // Hence it only allows its normalizers to be used for the JSON:API format, + // to avoid JSON:API-specific normalizations showing up in the REST API. + return $format === $this->format; + } + }