Skip to content

Symfony name converter breaking the OpenApi docs #3997

Description

@stiffroy

API Platform version(s) affected: 2.6.1

Description

If we use a Symfony name converter, the docs page is broken. The Authorize button on the top left which has been introduced in the version 2.6 is not shown. Also the Request Body section (between Parameters and Responses) under the endpoints are completely missing. So, you cannot also try out any endpoints as this section is completely missing

How to reproduce

Configure Api Platform to use the Symfony's camel-to-snake case converter as documented here
Activate the service:

# api/config/services.yaml
services:
    'Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter': ~

and then use it:

# api/config/packages/api_platform.yaml
api_platform:
    name_converter: 'Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter'

Now go and try some of your endpoints from the OpenApi (Swagger) docs. The Request Body section will no more show up. And the endpoints cannot be tested anymore.

Possible Solution

Not yet looked into it but my assumption is, something is breaking when this name converter is run. Didn't try yet with custom name convertor.

Additional Context

When trying with some API testing clients like Postman, both the parameters createdAt as well as created_at are working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions