On Mon, 13 Jun 2016 19:48:05 GMT, zunkree wrote:
I trying to write rest api client with vibe.d rest generator and figured that the such code:
class App { string id; string cmd; } interface IntREST { @path("/apps") @method(HTTPMethod.POST) App postApp(App app); }
sends body like:
{ "app": { "id": "value", "cmd": "command" } }
but I need to send without nesting into "app":
{ "id": "value", "cmd": "command" }
How I can avoid such behavior like nesting?
Currently there is no way, but we could do something like specializing @bodyParam
with an empty field name:
@bodyParam("app", "")
App postApps(App app);
It would then error out of there are other body parameters and otherwise would write the contents directly into the response body.