falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.51k stars 936 forks source link

Conflicting URI templates #663

Open hooblei opened 8 years ago

hooblei commented 8 years ago

Hi,

I'm trying to implement the following two resources

/foo/{id}
/foo/{id}/bar

But when adding the second route, falcon complains with an error: "The URI template for this route conflicts with another route's template".

I had seen some progress on similar issues (#564, #647) but I'm not sure if these fixes work for the described pattern too or when this will be merged/released.

So, is there any kind of workaround for the described URI patterns?

Thanks

hooblei commented 8 years ago

Found the answer in conflicts_with of CompiledRouterNode. This was just a naming issue. My example looked more like this:

/foo/{key}
/foo/{id}/bar

Using the same variable name works as expected ... maybe a good note for the docs?

kgriffs commented 8 years ago

Thanks for the report! I scheduled this as a documentation fix for 1.0.

kgriffs commented 7 years ago

We should document this as well as see if we can have the router print a more helpful error message. See also #794.

kgriffs commented 7 years ago

see also #535

kgriffs commented 7 years ago

TODO

pokidovea commented 7 years ago

I have two urls:

/game_api/units/{var1}/join
/game_api/units/{var2}/rebuild

It is necessary for me to specify different variable names. Why I have to specify the same name?