Coder Social home page Coder Social logo

oas_parser's Introduction

Open API Definition Parser

Nexmo is now known as Vonage

A Ruby parser for Open API Spec 3.0+ definitions.

Install

Install the gem:

$ gem install oas_parser

Or add it to your Gemfile:

gem 'oas_parser'

Usage

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

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

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 rubygems.org:

$ gem push oas_parser-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

oas_parser's People

Contributors

adambutler avatar mheap avatar fabianrbz avatar ahx avatar dependabot[bot] avatar piao-mdsol avatar chrisguzman avatar j-a-m-l avatar noma4i avatar dragonmantank avatar kfalconer avatar lornajane avatar ota42y avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.