On Thu, 26 Mar 2015 11:28:14 +0100, Marc Schütz wrote:

Am Thu, 26 Mar 2015 09:05:25 GMT
schrieb "Mathias LANG" pro.mathias.lang@gmail.com:

Now that 2.067 is out, I will resume my work on the new REST
generator. That's definitely something that could fit in. Do you need
the attributed parameter in addition, or do you just want to do some
kind of check (like isAuthenticated) ?

My use cases are authentication, authorization, input verification (e.g.
UTF8 validation), and catching exceptions with hypothetical @around
filters.

These require access to input parameters and modification of the
output, or even responding without calling the actual method.

I'd say that input verification should be part of the system (like it already is with vibe.web.validation). But UTF-8 validation is a good point, that should be added by default with a good error message and a BAD REQUEST reply.

Regarding exceptions, maybe a non-meta-solution like void delegate(Exception e, HTTPServerResponse res) RestInterfaceSettings.exceptionHandler is sufficient. @around should be still good to have for other use cases or very specific exception catching needs, but most of the time such a callback should be the better choice due to its lightweightness.

Hm... coming to think of it, there is a much simpler solution that requires no additions at all:

class MyRestInterface {
    @before!foo("bar"):

    void getSomething(int _bar);
    void getSomethingElse(int _bar);
}