Sinatra application that provides a preview of how the OAS documents will be rendered within Nexmo Developer.
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
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
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'
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.