项目作者: superiorlu

项目描述 :
Create a JSONAPI Swagger.
高级语言: HTML
项目地址: git://github.com/superiorlu/jsonapi-swagger.git
创建时间: 2019-04-18T02:53:22Z
项目社区:https://github.com/superiorlu/jsonapi-swagger

开源协议:MIT License

下载


JSONAPI Swagger

Generate JSONAPI Swagger Doc.

Gem Version
GitHub license

jsonapi-swagger-4-2-9.gif

Installation

Add this line to your application’s Gemfile:

  1. gem 'jsonapi-swagger'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install jsonapi-swagger

Usage

  1. config jsonapi swagger
    1. # config/initializers/swagger.rb
    2. Jsonapi::Swagger.config do |config|
    3. config.use_rswag = false
    4. config.version = '2.0'
    5. config.info = { title: 'API V1', version: 'V1'}
    6. config.file_path = 'v1/swagger.json'
    7. end
  1. generate swagger.json
  1. # gen swagger/v1/swagger.json
  2. bundle exec rails generate jsonapi:swagger User # UserResource < JSONAPI::Resource
  1. additional

    use rswag, have to run

  1. # gen swagger/v1/swagger.json
  2. 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.