On Saturday, 26 February 2022 at 11:38:16 UTC, Remi Thebault wrote:
On Saturday, 26 February 2022 at 11:26:54 UTC, max haughton wrote:
On Saturday, 26 February 2022 at 10:39:18 UTC, Remi Thebault wrote:
Hi all,

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

[...]

https://dlang.org/phobos/std_traits.html#getUDAs

How do I use `getUDAs` in this context?
I have `getUDAs!(req, Param).length == 0`. I think it only works on the struct attributes, not on the fields attributes.

Getting the UDAs from inside a symbol must be done via a recursive procedure in the same manner one would identify the aforementioned symbol i.e. you have to go through the fields looking for UDAs *then* use getUDAs.

This is because UDAs cannot convey information without their context, so the trait doesn't look recursively.

Reply via email to