Skip to content

Name converter configuration changes Symfony serializer globally, affecting whole project, not only API Platform managed part. #6101

Open
@vuryss

Description

@vuryss

API Platform version(s) affected: 3.2

Description
I'm trying to integrate API Platform in existing project, which already has multiple APIs defined. Those APIs all depend on Symfony serializer, and some of them use different case for the json fields - some camelCase, some snake_case.
For the new API we decided to go with API Platform, and we wanted all fields to be snake_case. However setting the name_converter according to the docs overwrites the global Symfony Serializer metadata-aware name converter and sets the snake_case as a fallback, making all of the existing APIs outside API Platform snake_cased.

I've tried overwriting the api_platform.name_converter via configuration, but it's hard defined in a MetadataAwareNameConverterPass and I cannot do anything about it inside the config file.

When setting a configuration specific to API Platform I expect it not to affect globally the rest of the project.

How to reproduce
Use serializer in any other place outside the API Platform while changing the name_converter in api_platform config.

Possible Solution
Allow using separate Serializer Name Converter specific for API Platform instead of modifying globally the default serializer name converter.

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