Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kodius/rswag-json-loader
Use JSON schema files with Rswag
https://github.com/kodius/rswag-json-loader
json json-schema rails rswag rswag-api
Last synced: 8 days ago
JSON representation
Use JSON schema files with Rswag
- Host: GitHub
- URL: https://github.com/kodius/rswag-json-loader
- Owner: kodius
- License: mit
- Created: 2023-10-19T12:36:03.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-19T22:26:39.000Z (about 1 year ago)
- Last Synced: 2024-12-18T17:14:38.091Z (10 days ago)
- Topics: json, json-schema, rails, rswag, rswag-api
- Language: Ruby
- Homepage: https://rubygems.org/gems/rswag_json_loader
- Size: 22.5 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this 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`
```ruby
gem 'rswag_json_loader'
```Add this line to your `swagger_helper.rb`
```ruby
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
```json
{
"type": "object",
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
}
```## 🚧 To-Do
* [ ] YAML support
* [ ] Tests