Skip to content

Missing key 'class' in $context['input'] from getExpectedInputClass function in PayloadArgumentResolver #5066

Description

@helyakin

API Platform version(s) affected: 2.7.*

Description
When using a custom DTO I'm facing this issue

Type error: ApiPlatform\Symfony\Bundle\ArgumentResolver\PayloadArgumentResolver::getExpectedInputClass(): Return value must be of type ?string, array returned (Behat\Testwork\Call\Exception\FatalThrowableError)

I went then to debug what was in $context['input'] and found out that it was containing indeed an array looking like:
['class' => ...., 'name' => ...]
And the key class contains the needed string

How to reproduce

Possible Solution
Returning return $context['input']['class'] ?? $context['resource_class'] in the getExpectedInputClass function from the PayloadArgumentResolver

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions