Open andrewpthorp opened 11 years ago
Hi
The colon template in uri_template is currently ultra-simple, so this isn't currently possible. I think it would be great if that was possible. My initial idea for the colon style templates was to implement rails/sinatra-style patterns so that people can simply reuse their routing patterns. So I'd prefer the rails syntax for conditionals: http://some.api.com(/:optional(/:optional2))
. Maybe subclassing the colon template class for the different flavours (rails, sinatra, your own ... ) would be an option, too.
Anyway, you have push access now.
Cheers' Hannes
Thanks! I'll work on this asap.
Cool!
Hi @andrewpthorp
Any progress so far? Can I help?
Hey @hannesg - I was actually on a family vacation all week last week. Going to start on this in the next few days.
I'll let you know where I can help, perhaps we can pair on it!
I would be more than willing to implement this, but I was wondering if it's desired or if it's already possible:
Let's say, you have the following template:
:optional2:
would only be added if:optional1
existed. In other words:I have seen this pattern implemented in a few APIs (we can debate the design of said APIs another time). Is this possible with uri_template? If not, would there be any interest in me adding it?
If there is interest in me adding it, could we discuss what the pattern would look like for both formats?
Thanks!