No commit activity in last 3 years
No release in over 3 years
Generate minimum OpenAPI 3 definition YAML from config/routes.rb in your Rails application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 5.2.3
 Project Readme

Openapi3DefinitionGenerator::Rails

CircleCI

Generate minimum OpenAPI 3 definition YAML from config/routes.rb in your Rails application.

⚠️ This gem uses Rails private API so may be broken in future.

Usage

How to use my plugin.

Installation

Add this line to your application's Gemfile:

gem 'openapi3_definition_generator-rails'

And then execute:

$ bin/rails openapi3_definition:generate_yaml

example

In this config/routes.rb ...

Rails.application.routes.draw do
  resources :users

  get '/foo/:bar', to: 'foo#show'
end

generates this yaml.

---
openapi: 3.0.0
info:
  title: ''
  description: ''
  version: 0.1.0
paths:
  "/users(.:format)":
    get:
      summary: users
      description: users#index
      responses:
    post:
      summary: ''
      description: users#create
      responses:
  "/users/new(.:format)":
    get:
      summary: new_user
      description: users#new
      responses:
  "/users/:id/edit(.:format)":
    get:
      summary: edit_user
      description: users#edit
      responses:
  "/users/:id(.:format)":
    get:
      summary: user
      description: users#show
      responses:
    patch:
      summary: ''
      description: users#update
      responses:
    put:
      summary: ''
      description: users#update
      responses:
    delete:
      summary: ''
      description: users#destroy
      responses:
  "/foo/:bar(.:format)":
    get:
      summary: ''
      description: foo#show
      responses:

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.