Skip to content
Render your API references, Nexmo-style!
Ruby HTML CSS JavaScript Shell
Branch: master
Clone or download
Fabian Rodriguez and mheap Prevent sinatra from showing error traces.
* Use default settings for error handling (`show_exceptions`): Shows a stack
trace in the browser when an exception happens. Enabled by default when
environment is set to "development", disabled otherwise.

* Raise appropriate exception when a doc is not found.

* Use custom 500 page for errors.
Latest commit 2e3393a Oct 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Encapsulate the sinatra app into a gem. May 24, 2019
exe
lib/nexmo/oas Prevent sinatra from showing error traces. Nov 29, 2019
spec Sync all oneOf tab states if x-tab-link is provided Sep 13, 2019
.env.example
.gitignore Fix oneOf responses (#12) Aug 27, 2019
.rspec Autodetect schemas from OAS files instead of using config files. (#7) Jul 10, 2019
CHANGELOG.md Bump version and update CHANGELOG.md Nov 6, 2019
CONTRIBUTING.md Add CONTRIBUTING.md. May 24, 2019
Gemfile upgraded to Rails 6 Oct 6, 2019
Gemfile.lock Bump loofah from 2.3.0 to 2.3.1 Nov 6, 2019
LICENSE.txt Fix License. May 24, 2019
README.md Remove mentions of `OAS_CI` which is no longer needed. Oct 24, 2019
Rakefile Encapsulate the sinatra app into a gem. May 24, 2019
nexmo-oas-renderer.gemspec Render required tag for oneOf request bodies Oct 28, 2019

README.md

Nexmo OAS Renderer

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

Dependencies

Installation and Usage

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/config.ru

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.
Rails.application.initialize!

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.

Note

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

Contributing

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.

License

This project is under the MIT LICENSE.

You can’t perform that action at this time.