Closed Stefanobosio closed 4 years ago
Are you sure FOSRestBundle correctly configures your route as /api/page-data/{pageData}
?
It ignores several classes by default (see the list) and doesn't add them as path parameters so this may explain your issue if you extend from one of these classes.
Hello Guilhem, yes you're right! I tried a couple to interface and unfortunately both of them were on that list. I couldn't find any information about this in the documentation, thank you very much for the tip!
Hello, I'm using FosRestBundle automatic enpoint's nomenclature. I noticed that, if a GET endpoint has a parameter reflecting an Entity that implements an interface, the path parameter is not shown in the doc's endpoint.
My setup is:
"symfony" 4.4.7 "nelmio/api-doc-bundle 3.6.1 "friendsofsymfony/rest-bundle" 2.7.1
What i expect in api/doc page: /api/page-data/{pageData}
What's shown: /api/page-data
No parameters at all are shown in the endpoint documentation even when i explode the endpoint.
How to reproduce:
src/Entity/PageData.php
class PageData implements WhateverInterface { ... }
src/Controller/TestController.php
If i force the parameter in this way i can see the parameter when exploding the documentation but the url always remains /api/page-data
I can get the result i want only if i explicitly put this annotation:
* @Rest\Route("/page-data/{pageData}")
but i want to use automatic routing from FosRestBundle.
Is there a way I can have the automatic route parameter?
Thank you