Open mikevandiepen opened 1 month ago
Hey @mikevandiepen,
They look grouped correctly to me. Each route is under "equipment-accessories" correctly and them being within folders as per the end of the route name makes it easily readable at a glance which route belongs to which without having to can your eyes across the length of the entire route.
What I mean is the four separate requests belong to the same controller and are grouped to the same route-name, only a different identifier (..*.{x,y,z}). These requests are put in separate folders instead of grouped inside the parent, but if it is intentional then I understand it, it just threw me off haha
Definitely understand, and it is indeed intentional so that at a glance you can see which route request is the "attach" one for example, or the "sync" one and so on, without having to put much thought into the request method (like PUT) or having to take a longer look at the route name.
I'd be open to a PR to add a config option for flattening this structure though if it were something you'd like to take on?
If you can point me to the right direction I might try this weekend! A little clue could be a nice headstart :)
Sure thing, @mikevandiepen.
You'll probably want to add a config option like 'flattened_routes' => false,
(default to false), and if it's true, then you'll want to avoid adding the last route name segment as a nested directory.
This should be roughly the right area, as this is where we handle the other config options related to the route folder conventions.
I'd recommend starting with a test case (we have existing ones for ensuring outputs are a certain way already), so you can duplicate one and modify it to suit what you expect the output to be, and then do the code changes necessary to get it to pass.
When exporting the postman suite my routes are not grouped "correctly", these routes:
ROUTE:
api/v1/versions/{version}/equipment/{equipment}/accessories
NAME:versions.equipment.equipment-accessories.index
ROUTE:
api/v1/versions/{version}/equipment/{equipment}/accessories
NAME:versions.equipment.equipment-accessories.sync
ROUTE:
api/v1/versions/{version}/equipment/{equipment}/accessories/{accessory}
NAME:versions.equipment.equipment-accessories.attach
ROUTE:
api/v1/versions/{version}/equipment/{equipment}/accessories/{accessory}
NAME:versions.equipment.equipment-accessories.detach
Actual output:
Expected output:
I believe this issue is caused by mapping it using the "namespace" instead of the route-name?
This is my controller: