On Tue, 13 Mar 2018 13:10:58 -0400, Steven Schveighoffer wrote:

On 3/13/18 12:28 PM, James Blachly wrote:

Hi all,

Why, when using the REST interface generator, are my routes calculated differently depending on the parameter name?

Specifically, getField(int id) is routed as :id/field (and this is true for any in (id1, id2, ...), whereas getField(int whateverothername) is routed as field with required URL encoded parameter whateverothername. Why is there special behavior for ‘id’ , and where can I find this documented?

Thanks in advance -- looking forward to playing with vibe.d.

The only place I can find it "documented" online is here:

http://vibed.org/api/vibe.web.rest/registerRestInterface

If you look in the example, it shows :id being used.

I did see that, but my confusion stems from the fact that parameters not named id will be interpreted as URL-encoded parameters, whereas parameter named id is integrated in the route. I guess this is more of a comment than a question: this is counter-intuitive and undocumented(?). Surprises like this make me hesitant to proceed with the (any) framework overall.

But I don't see why it should use "id1" or "id2" anywhere. It's hard to
follow the code to see where this is determined.

I have to recant; and must not have compiled the version of code I thought I did, because I now cannot reproduce this behavior (i.e., pattern matching id* ; comment still stands for parameter simply named id)

I remember reading it in Kai's book.

-Steve

Going to buy the ebook now...

James