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
|
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
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(orgin) support this flow.Example Failure
https://go.dev/play/p/6Xu_jNomZtP
httprouter/tree.go
Lines 169 to 173 in 3425025
I understand it's not supported today, but can we add support for same-path but different parameter names?
Related Issues
*wildcard conflict with static*wildcard conflicts with:wildcard:wildcard