Open API Definition Parser

A Ruby parser for Open API Spec 3.0+ definitions.


Install the gem:

“ gem install oas_parser

Or add it to your Gemfile:

“by gem ‘oas_parser’


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

“by require ‘oas_parser’

definition = OasParser::Definition.resolve(‘petstore.yml’)

=> #OasParser::Definition

Get a specific path

path = definition.path_by_path(‘/pets’)

=> #OasParser::Path

Get all paths.


=> [#, ]

Get a specific endpoint by method

endpoint = path.endpoint_by_method(‘get’)

=> #OasParser::Endpoint

Get all endpoints


=> [#, ]

Get 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.


Run tests:

“ rspec


Clone the repo and navigate to its directory:

“ cd oas-parser

Bump the latest version in oas_parser/lib/oas_parser/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.gemspec

This will create a oas_parser-1.1.0.gem file.

Push the gem to

“ gem push oas_parser-1.1.0.gem

Verify the change was made by checking for the new version on


Contributions are welcome, please follow GitHub Flow