Skip to content

Add "application/vnd.api+json" support for #[MapRequestPayload] #60701

@LeikoDmitry

Description

@LeikoDmitry

Symfony version(s) affected

7.1

Description

In our project we use header “application/vnd.api+json” for REST API and when we call the required controller we get “Unsupported format” exception. Is it possible to make an additional parameter in the future so that we can specify the required “Content-type”?

How to reproduce

Add header Content-Type with application/vnd.api+json

Possible Solution

MapRequestPayload.php

public function __construct(
        public readonly array|string|null $acceptFormat = null,
        public readonly array $serializationContext = [],
        public readonly string|GroupSequence|array|null $validationGroups = null,
        string $resolver = RequestPayloadValueResolver::class,
        public readonly int $validationFailedStatusCode = Response::HTTP_UNPROCESSABLE_ENTITY,
        public readonly ?string $type = null,
        public readonly ?string $contentType = null,
    ) {
        parent::__construct($resolver);
    }

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions