Hi all,

I'm trying to establish a REST API by using the type system (used in both client and server code).

Considering the code

```d
struct Request
{
    Method method;
    string url;
    int apiLevel;
}

@Request(Method.GET, "/my-resource/%s", 1)
struct MyResourceGet
{
    @Param
    string name;

    // other members...
}

string requestUrl(ReqT)(ReqT req) if (isRequest!ReqT)
{
    import std.format : format;
    import std.traits : getSymbolsByUDA;

    Request reqAttr = RequestAttr!ReqT;

    alias paramSymbols = getSymbolsByUDA!(ReqT, Param);
    // return format(reqAttr.url, ????);
}

unittest
{
    MyResourceGet req;
    req.name = "thisone";
    assert(requestUrl(req) == "/my-resource/thisone");
}
```

In `requestUrl`, how do I actually get the value of `req.name` from `paramsSymbols` and `req`?

Reply via email to