Interferes with Views REST export Serialization

Created on 26 September 2023, about 1 year ago
Updated 18 December 2023, 11 months ago

Problem/Motivation

When using a View with a REST export, the Serializer will use the MultiresponseJsonNormalizer to serialize array values
for the json format.

This results in the REST export returning weird values:

[
    {
        "should_be_empty_array": {
            "content": "[]",
            "headers": {
                "X-Sub-Content-Type": null,
                "Content-Type": "application/json"
            }
        }
    }
]

Steps to reproduce

Create a new View with a REST export.
Set Format to Serializer and accepted request format to JSON.
Show Fields and add a field that is a reference to multiple other entities and set output to Raw value.

The Serializer will then use the MultiresponseJsonNormalizer to serialize arrays.

Proposed resolution

Update the supportsNormalization() method of the MultiresponseJsonNormalizer to not normalize the data when the context contains the key views_style_plugin.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Postponed: needs info

Version

3.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria chfoidl Salzburg

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024