The project is in a healthy, maintained state
Load JSON schemas into RSwag's Swagger/OpenAPI spec
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

💎 rswag-json-loader

Use JSON schema files for your Swagger/OpenAPI definitions, instead of storing them in swagger_helper.rb

🚀 Installation

Add this line to your Gemfile

gem 'rswag_json_loader'

Add this line to your swagger_helper.rb

RswagJsonLoader::SchemaHandler.setup!

By default, JSON Schema files are expeted to be in:

./spec/requests/api/schemas/json/*.json

If you want them elsewhere, override schema_path.

👷 Usage

Just create a JSON file in the aforementioned folder, e.g. sessions_login_payload.json, enter your JSON Schema inside it

{
  "type": "object",
  "required": [
    "email",
    "password"
  ],
  "properties": {
    "email": {
      "type": "string"
    },
    "password": {
      "type": "string"
    }
  }
}

🚧 To-Do

  • YAML support
  • Tests