-
-
Notifications
You must be signed in to change notification settings - Fork 900
Named operations stopped working after upgrade to 3.0.5 #5235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I did not still debugged what happened, but some of my routes stop to work with this new path release. Only some of them: PHPUnit tests fail. There is something broken, but I don't know what at the moment. This comment is just to confirm the issue. |
May be linked to #5234 |
it doesn't look like you have a route called the same right ? bring me an error + stack trace please. Note that you can also use |
There is no actual error per say but in 3.0.5. it only generates last defined operation with some auto generated name and not the one i gave it. you can see what warnings come up in api-resource dump file for 3.0.5. i attached. i attached dump for 3.0.4. as well to see the difference. |
I don't think issue here is token route cause if i comment out get operation and leave remaining 2 post operations, behaviour does not change -> only last operation is defined and with wrong name |
oh yeah this is no bueno looking at it |
let's close this as dup of #5234 |
if you used the API platform: 3.0.5 This is what I deduced after two days of debugging. In your case: you have the choice, either you do In the case where you have a uri at the end only, it will have the form {id} and not {userId} ❌uriTemplate: '/warehouses/inventory/{warehouseId}', |
API Platform version(s) affected: 3.0.5
Description
Named operations not working after upgrade to 3.0.5
How to reproduce
As far as I can debug (I'm new to api platform, so I can't really tell what is wrong here), it has something to do with
ApiPlatform\Metadata\Resource\Factory\OperationDefaultsTrait
or something before it is used. It fails inprivate function getOperationWithDefaults(ApiResource $resource, Operation $operation, bool $generated = false): array
function onif (!$operations->has($operation->getName())) {
line.Before 3.0.5 incoming
ApiResource $resource
had defined operations array with keys 0, 1, 2, ... etc, but as of 3.0.5 incoming resource has operations array with already defined names like password_set, password_reset etc, which fails this name check function as there can't be two routes with same name.If I don't define name property, it generates routes as expected but then I can't tell operations apart in processor nor generate path to named route.
Additional Context
Worked before 3.0.5
The text was updated successfully, but these errors were encountered: