Nexmo OAS Renderer

Build Status MIT licensed

Sinatra application that provides a preview of how the OAS documents will be rendered within Nexmo Developer.


Installation and Usage

Using Docker

You can run using Docker and it will serve the current directory (this will usually be the api-specification repo):


docker run --rm -p 4567:4567 -v `pwd`:/definitions -e 'OAS_PATH=/definitions' nexmodev/nexmo-oas-renderer:latest

Alternatively, add the following to your ~/.bashrc file and you'll be able to run nexmo-oas-renderer

function nexmo-oas-renderer() {
  docker run --rm -p 4567:4567 -v `pwd`:/definitions -e 'OAS_PATH=/definitions' nexmodev/nexmo-oas-renderer:latest


docker run --rm -p 4567:4567 -v %CD%:/definitions -e 'OAS_PATH=/definitions' nexmodev/nexmo-oas-renderer:latest

As a standalone application

Install the gem:

$ gem install nexmo-oas-renderer

And simply run the executable with the corresponding env variables set (see Note):

$ nexmo-oas-renderer

Or, if you want to make code changes, just run the following command which will start the web server on http://localhost:9393:

OAS_PATH=... bundle exec shotgun lib/nexmo/oas/renderer/

Mounted into a Rails Application

Add this to your application's Gemfile:

gem 'nexmo-oas-renderer', require: false

And then run bundle install.

Require the gem in config/environment.rb as follows:

# Load the Rails application.
require_relative 'application'

require 'nexmo/oas/renderer'

# Initialize the Rails application.

And finally mount the Sinatra app into your Rails application by adding the following line to config/routes.rb:

mount Nexmo::OAS::Renderer::API, at: '/api'

Specifying the path to the documents

This gem uses dotenv to handle environment variables, so you should copy the .env.example provided by running:

$ cp .env.example .env

and assign values to the corresponding variables.


The env variable OAS_PATH indicates the path to the documents that will be rendered.


We ❤️ contributions from everyone! Bug reports, bug fixes and feedback on the library is always appreciated. Look at the Contributor Guidelines for more information and please follow the GitHub Flow.


This project is under the MIT LICENSE.