Skip to content

Undefined array key "resource_class" in SerializerContextBuilder without even using API Platform #7574

@emodric

Description

@emodric

API Platform version(s) affected: 4.2.8

Description

When using custom value resolvers from Symfony, and when my request has a data POST variable, API Platform's PayloadArgumentResolver kicks in and tries to resolve if the request is an API Platform request.

This ultimately fails with a warning Warning: Undefined array key "resource_class" in ApiPlatform\Serializer\SerializerContextBuilder, preventing our custom request from working.

How to reproduce

Implement a custom value resolver in Symfony and have a post request with a data POST variable.

Possible Solution

Lower the priority of PayloadArgumentResolver in controller.argument_value_resolver to e.g. 255 so it does not interfere with the default priority of value resolvers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions