mirror of
https://github.com/ditkrg/jsonapi-swagger.git
synced 2026-01-22 13:56:54 +00:00
Create a JSONAPI Swagger.
| bin | ||
| lib | ||
| .gitignore | ||
| Gemfile | ||
| jsonapi-swagger.gemspec | ||
| LICENSE | ||
| Rakefile | ||
| README.md | ||
JSONAPI Swagger
Generate JSONAPI Swagger Doc.
Installation
Add this line to your application's Gemfile:
gem 'jsonapi-swagger'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jsonapi-swagger
Usage
- config jsonapi swagger
# 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
- generate swagger.json
# gen swagger/v1/swagger.json
bundle exec rails generate jsonapi:swagger User # UserResponse < JSONAPI::Resource
- additional
use rswag, have to run
# gen swagger/v1/swagger.json
bundle exec rails rswag:specs:swaggerize
RoadMap
- immutable resources
- filter/sort resources
- mutable resources
- generate swagger.json without rswag
Resource
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/superiorlu/jsonapi-swagger.
