Generate an handler that will wrap the server's method
This function returns an handler, generated at compile time, that will deserialize the parameters, pass them to the function implemented by the user, and return what it needs to return, be it header parameters or body, which is at the moment either a pure string or a Json object.
One thing that makes this method more complex that it needs be is the inability for D to attach UDA to parameters. This means we have to roll our own implementation, which tries to be as easy to use as possible. We'll require the user to give the name of the parameter as a string to our UDA. Hopefully, we're also able to detect at compile time if the user made a typo of any kind (see genInterfaceValidationError).
Note
Lots of abbreviations are used to ease the code, such as
PTT (ParameterTypeTuple), WPAT (WebParamAttributeTuple) and PWPAT (ParameterWebParamAttributeTuple).
Parameters
T | type of the object which represent the REST server (user implemented). |
Func | An alias to the function of T to wrap. |
inst | REST server on which to call our Func. |
settings | REST server configuration. |
Returns
A delegate suitable to use as an handler for an HTTP request.