Open jlekowski opened 3 years ago
In general FOSRestBundle
annotations seem to overwrite Swagger-Php
annotations (I believe it should be the other way around). For example for query parameters default
, pattern
, and format
are taken from FOSRestBundle
annotations https://github.com/nelmio/NelmioApiDocBundle/blob/master/RouteDescriber/FosRestDescriber.php#L150
I have the same problem in my project. Thank you for your workaround, it works for me now!
This should be addressed though, because using both FOSRestBundle and NelmiApiDocBundle is a logical thing to do ...
Adjusted the title to be (hopefully) more descriptive of the desired change here.
Thank you for the workaround. It was quite useful for me. I had identical problem while using FOSRestBundle and NelmioApiDocBundle.
Is there any progress with the issue?
With both
FosRestBundle
andApiDocBundle
annotations, I get the following warning:The warning is triggered from https://github.com/zircote/swagger-php/blob/3.1.0/src/Annotations/AbstractAnnotation.php#L407 when requesting
nelmio_api_doc.controller.swagger
ornelmio_api_doc.controller.swagger_ui
(in my case I accessed/api/doc.json
URL).The reason for that is that both
PhpDocDescriber
andFosRestDescriber
addapplication/json
media type to request body. One adds using numeric key here https://github.com/zircote/swagger-php/blob/3.1.0/src/Annotations/AbstractAnnotation.php#L176. Another one using media type (e.g.application/json
) as a key https://github.com/nelmio/NelmioApiDocBundle/blob/master/RouteDescriber/FosRestDescriber.php#L131. So we end up having both and the warning. My workaround is to add a normalizer that removes media type added byFosRestDescriber
if also one added byPhpDocDescriber
is present https://gist.github.com/jlekowski/c2c959426bec31aa6ec4187537339f81. I wantPhpDocDescriber
to take precedenceAn example controller: