Skip to content

footer links incorrect when overriding swagger/OpenAPI route #2654

Open
@MyDigitalLife

Description

@MyDigitalLife

If you follow the instructions on https://api-platform.com/docs/core/swagger/#manually-registering-the-swagger-ui-controller for changing the docs route the footer links won't work. In the example the route is named 'swagger_ui', this is fine and it works but it won't work for the footer links to redoc and swagger.

I have the my swagger url /docs and the urls in the footer link to /?ui=redoc while is should be /docs?ui=redoc.

I checked the template code and it has this:

{% if swaggerUiEnabled and active_ui != 'swagger_ui' %}<a href="{{ path('api_entrypoint') }}">Swagger UI</a>{% endif %}
{% if reDocEnabled and active_ui != 're_doc' %}<a href="{{ path('api_entrypoint', {'ui': 're_doc'}) }}">ReDoc</a>{% endif %}

So one of two things is wrong here. The template should not have api_entrypoint but swagger_ui or the documentation need to be updated to show you need to override api_entrypoint not swagger_ui in your route file. I think option one is the correct one but please correct me if I am wrong.

I also just noticed when on the redoc page that the url parameter disappears if you use the footer links to switch format. So you will go to ?_format=jsonapi instead of ?ui=redoc&_format=jsonapi.

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