Add swagger compliant documentation to your maru API
Clone or download
Latest commit e3dfad2 Apr 19, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
config first commit Jun 1, 2015
lib upgrade to maru v0.13.0 Apr 19, 2018
test upgrade to maru v0.13.0 Apr 19, 2018
.formatter.exs code format Feb 21, 2018
.gitignore add /doc folder to gitignore Nov 23, 2016
.travis.yml Release v0.8.3 Oct 17, 2017 Release v0.8.5 Apr 19, 2018
LICENSE add LICENSE Jun 2, 2015 update Jan 6, 2017
mix.exs Release v0.8.5 Apr 19, 2018


Build status Version Hex downloads


GOTCHA: Please keep swagger DSL out of version!

def deps do
  [ {:maru_swagger, github: "elixir-maru/maru_swagger"} ]

defmodule Router do
  version "v1"

defmodule API do
  use Maru.Router
  use MaruSwagger

  plug Plug.Logger

  swagger at:         "/swagger",      # (required) the mount point for the URL
          pretty:     true,            # (optional) should JSON be pretty-printed?
          only:       [:dev],          # (optional) the environments swagger works
          except:     [:prod],         # (optional) the environments swagger NOT works
          force_json: true,            # (optional) force JSON for all params instead of formData

          swagger_inject: [            # (optional) this will be directly injected into the root Swagger JSON
            host: "",
            basePath: "/api",
            schemes:  [ "http" ],
            consumes: [ "application/json" ],
            produces: [

  mount Router

and then you can get json response from curl

open Swagger Petstore in your borwser and fill in and enjoy maru_swagger.