Skip to content

Swagger ui overwrites html encoder response #804

@maechler

Description

@maechler

I have recently updated api-platform/core from beta to rc2. Since that the swagger ui overwrites all our html encoder responses. I feel like there is something wrong with the condition here: https://github.com/api-platform/core/blob/master/src/Bridge/Symfony/Bundle/EventListener/SwaggerUiListener.php#L27-L28

If we request for instance an url like http://fancy-api.com/documents/1 and we have an html encoder registered the condition for exiting that function are not met:

if ('html' !== $request->getRequestFormat(null) 
    || (!$request->attributes->has('_api_resource_class') && !$request->attributes->has('_api_respond'))
    ) {
        return;
    }

reads:

if (false 
    || (!true && !false)
    ) {
        return;
    }

I think in the earlier version the swagger ui was only triggered on the route /apidoc. Maybe it would be possible to have something like this:

/doc --> swagger ui
/doc.jsonld --> hydra doc

What do you guys think?

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