Low commit activity in last 3 years
A parser for Open API specifications
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 4.7.3
~> 0.11.3
~> 13.0
~> 3.0
~> 0.15.1

Runtime

 Project Readme

Gem Version Build Status Coverage Status Gem GitHub commit activity GitHub last commit GitHub code size in bytes
This repository is a fork of nexmo/oas_parser that is no longer maintained. So in case you want to contribute do it here.


Open API Definition Parser

A Ruby parser for Open API Spec 3.0+ definitions.

Install

Install the gem:

$ gem install oas_parser_reborn

Or add it to your Gemfile:

gem 'oas_parser_reborn'

Usage

Here is a basic example of how you can traverse through an Open API Spec 3 Definition:

require 'oas_parser_reborn'

definition = OasParser::Definition.resolve('petstore.yml')
# => #<OasParser::Definition>

# Get a specific path
path = definition.path_by_path('/pets')
# => #<OasParser::Path>

# Get all paths.
definition.paths
# => [#<OasParser::Path>, ...]

# Get a specific endpoint by method
endpoint = path.endpoint_by_method('get')
# => #<OasParser::Endpoint>

# Get all endpoints
path.endpoints
# => [#<OasParser::Endpoint>, ...]

# Get endpoint description
endpoint.description
# => "Returns all pets from the system that the user has access to"

Checkout the tests and lib directory for more classes and methods.

Development

Run tests:

$ rspec

Publishing

Clone the repo and navigate to its directory:

$ cd oas_parser_reborn

Bump the latest version in oas_parser_reborn/lib/oas_parser_reborn/version.rb:

//old
module OasParser
  VERSION = '1.0.0'.freeze
end

//new
module OasParser
  VERSION = '1.1.0'.freeze
end

Build the gem:

$ gem build oas_parser_reborn.gemspec

This will create a oas_parser_reborn-1.1.0.gem file.

Push the gem to rubygems.org:

$ gem push oas_parser_reborn-1.1.0.gem

Verify the change was made by checking for the new version on rubygems.org

Contributing

Contributions are welcome, please follow GitHub Flow