swaggerize 0.2.2

A swagger library for vibe-d server.


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Swaggarize Build Status

Swagger library for D programming language

How to use it

Create handlers

module myapp.handlers;

import vibe.d;
import swaggerize.composites;

@swaggerPath("/hello", OperationsType.options)
void optionsList(string name)(HTTPServerRequest /*req*/, HTTPServerResponse res) {
  res.writeBody("hello world!");
}

Create vibe.d instance

import vibe.d;
import swaggerize.parser;
import swaggerize.composites;
import myapp.handlers;

MongoClient client;

shared static this()
{
  auto definitions = swaggerizeJson("./api.json");

  auto settings = new HTTPServerSettings;
  settings.port = 8080;
  settings.options = HTTPServerOption.parseQueryString | HTTPServerOption.parseJsonBody;

  client = connectMongoDB("127.0.0.1");

  auto router = new URLRouter;
  router.register!(myapp.handlers)(definitions);

  listenHTTP(settings, router);
}

Authors:
Szabo Bogdan
Dependencies:
vibe-d
Versions:
0.2.2 2017-Aug-03
0.2.1 2017-Aug-02
0.2.0 2016-Oct-23
0.1.6 2016-Aug-27
0.1.5 2016-Jul-17
Show all 11 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 19 downloads this month

  • 379 downloads total