Description

A swagger library for vibe-d server.

Package Information

Version0.2.0 (2016-Oct-23)
Repository https://github.com/gedaiu/swaggarize
LicenseMIT
CopyrightCopyright © 2015, Szabo Bogdan
AuthorsSzabo Bogdan
Registered bySzabo Bogdan
Dependencies

vibe-d

Installation

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

dub.json
dub.sdl

Readme

Swaggarize

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);
}

Available versions

0.2.0 0.1.6 0.1.5 0.1.4 0.1.3 0.1.2 0.1.1 0.1.0 ~master