3) I have a rest endpoint that needs to return a generated XML file.

We just need to decide on a design for this, as the original
implementation was targeted at a pure JSON based protocol. Some possible
(non-exclusive) approaches:

  • Support OutputStream parameters and @contentType annotations,
    similar to the web interface generator. This is mainly useful for
    returning large binary data blobs (files), but would lose static typing
    in the D interface.

Seems like a good approach.

I'm also looking for a similar mechanism and already noted it on Github, but since I'm not sure if it gets attention in a PR discussion, I'll also propose it here:

I think it would be a good idea to allow the specification of custom serialization/deserialization code using UDAs. That way, rest interfaces could keep their static typing while giving the programmer control over the representation of his types where needed.

My simplistic example on Github looks like this, but could certainly also be written in terms of streams:

class MyCustomSerializer
{
    ubyte[] serialize(T value) { /* serialize the value */ }
    T deserialize(ubyte[] serialized) { /* de-serialize the data */ }
}

interface IMyRestInterface
{
    @serialized!(new MyCustomSerializer())
    T getSomething();
}