On Sat, 20 Jul 2019 19:34:20 GMT, Vijay Nayar wrote:

On Sat, 20 Jul 2019 19:16:42 GMT, Vijay Nayar wrote:

According to the documentation for the @after UDA, we have the following:

http://vibed.org/api/vibe.web.rest/after

For reference, the same error also happens when using registerRestInterface as well in vibe.web.rest, just it happens in different code.

The errors themselves can be worked around by simply turning off the --vverbose option, so it is not a blocking bug.

For a better illustration of the use case, I have included a demonstration of how arbitrary MediaType conversions can be implemented on top of Vibe.d.

https://gist.github.com/vnayar/0da1c50faaece10a8bf65d76aff08456

This case is relatively simple, but there are many use cases that can be built up using this code in slightly different ways. For example:

  • Having a controller support two mediatypes, e.g. using Protobuf for efficiency in service communication, but still support JSON for debugging.
  • Providing data that is not JSON in a consistent way, e.g. having some endpoints produce pictures, PDFs, CSV, etc.