-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
I see many similar issues, but I can't quite find one for tracking this particular feature request to support same-branch wildcards with different names.
Problem
I'm doing some OpenAPI code generation stuff and I'd like to use the parameter names from that document to build out the router path. But sometimes, the parameter in OpenAPI don't match up with other operations in the same tree. I can't change the parameter names in this OpenAPI document, I'd like to have httprouter
(or gin
) support this flow.
Example Failure
router := httprouter.New()
router.GET(`/foo/:bar`, h)
router.GET(`/foo/:fighters/are/great`, h)
panic: ':fighters' in new path '/foo/:fighters/are/great' conflicts with existing wildcard ':bar' in existing prefix '/foo/:bar'
https://go.dev/play/p/6Xu_jNomZtP
Lines 169 to 173 in 3425025
panic("'" + pathSeg + | |
"' in new path '" + fullPath + | |
"' conflicts with existing wildcard '" + n.path + | |
"' in existing prefix '" + prefix + | |
"'") |
I understand it's not supported today, but can we add support for same-path but different parameter names?
Related Issues
- Non-wildcard routes that share a prefix with a wildcard route should take priority over the wildcard route #73 -
*
wildcard conflict with static - misleading panic message with non matching wildcard paths params #151 - multi-wildcard name for same branch (this issue) but closed w/ better error handling
- static segment conflicts with wildcard segment #183 - static conflicts with wildcard
- ServeFiles not able to serve static files #337 -
*
wildcard conflicts with:
wildcard - Allowing only specified values of path parameter #203 - static conflicts with
:
wildcard
Metadata
Metadata
Assignees
Labels
No labels