Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/superiorlu/jsonapi-swagger
Create a JSONAPI Swagger.
https://github.com/superiorlu/jsonapi-swagger
fast-jsonapi i18n json jsonapi jsonapi-rails jsonapi-resources rspec rswag swagger
Last synced: 7 days ago
JSON representation
Create a JSONAPI Swagger.
- Host: GitHub
- URL: https://github.com/superiorlu/jsonapi-swagger
- Owner: superiorlu
- License: mit
- Created: 2019-04-18T02:53:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-11-14T21:06:51.000Z (about 2 years ago)
- Last Synced: 2024-03-15T01:21:22.864Z (9 months ago)
- Topics: fast-jsonapi, i18n, json, jsonapi, jsonapi-rails, jsonapi-resources, rspec, rswag, swagger
- Language: HTML
- Homepage:
- Size: 36.1 KB
- Stars: 55
- Watchers: 4
- Forks: 29
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starred - superiorlu/jsonapi-swagger - Create a JSONAPI Swagger. (json)
README
# JSONAPI Swagger
Generate JSONAPI Swagger Doc.
[![Gem Version](https://img.shields.io/gem/v/jsonapi-swagger.svg)](https://rubygems.org/gems/jsonapi-swagger)
[![GitHub license](https://img.shields.io/github/license/superiorlu/jsonapi-swagger.svg)](https://github.com/superiorlu/jsonapi-swagger/blob/master/LICENSE)[![jsonapi-swagger-4-2-9.gif](https://i.loli.net/2019/05/05/5ccebf5e782b7.gif)](https://i.loli.net/2019/05/05/5ccebf5e782b7.gif)
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'jsonapi-swagger'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install jsonapi-swagger
## Usage
1. config jsonapi swagger
```rb
# config/initializers/swagger.rb
Jsonapi::Swagger.config do |config|
config.use_rswag = false
config.version = '2.0'
config.info = { title: 'API V1', version: 'V1'}
config.file_path = 'v1/swagger.json'
end
```2. generate swagger.json
```sh
# gen swagger/v1/swagger.json
bundle exec rails generate jsonapi:swagger User # UserResource < JSONAPI::Resource
```3. additional
use `rswag`, have to run
```sh
# gen swagger/v1/swagger.json
bundle exec rails rswag:specs:swaggerize
```## RoadMap
- [x] immutable resources
- [x] filter/sort resources
- [x] mutable resources
- [x] generate swagger.json without rswag## Resource
- [JSONAPI](https://jsonapi.org/)
- [JSONAPI::Resources](http://jsonapi-resources.com/)
- [Rswag](https://github.com/domaindrivendev/rswag)## Contributing
Bug reports and pull requests are welcome on GitHub at
https://github.com/superiorlu/jsonapi-swagger.