jsonapi-swagger 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d75e88719af0dce5ecee9e6063d2d25c9592038293ebc26340afd2c692e9c1f
4
- data.tar.gz: 30b4a6d0d565c712c4781ff7115ff15e4c9a8cd2397b476bf60ffea91ef63208
3
+ metadata.gz: e2396430a85aede1cfd926f160bde4437a848492306b4faaf2e153287140b5f1
4
+ data.tar.gz: 9f09eb3b646ab27c3357d93c5b1ad542f8abb507186ac476b9ec17c98df10426
5
5
  SHA512:
6
- metadata.gz: d2c380d494e0f6b2c094266e50c45b0faef5f51cac0b3bab76a1e32027a9e63adeaf4d63f6652e6ed2c56d0c797bc54d659fd124d5a000c13173401bee0eeb64
7
- data.tar.gz: 6881dcef1d7f977aee13f837b5b8809cb7bdcbfe3b745f00d4c8af8cc198132c42419daf6bae2a171dafe92daf5d4349b08b57ee5451c192a4883b321ac3e5b9
6
+ metadata.gz: 13d71fa7dcc74a753a8f5ce78078e70031eb95b2bd9f10f71a1ea16c644c86fa8909b2766f65cdc9ff7e91a1432824983e70a5647e2956c3243c034f5b0f9c25
7
+ data.tar.gz: 8063865a8234b71e50f0593f176c6b3e796f5c4a932022380649739ef677d62336b39a52bf0c90359381ae93b9f493a4ba4d97f66ee54409a1fa0c1f248c6d06
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Generate JSONAPI Swagger Doc.
4
4
 
5
- [![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.md)
5
+ [![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)
6
6
 
7
7
  ## Installation
8
8
 
@@ -11,7 +11,9 @@ RSpec.describe '<%= resouces_name %>', type: :request do
11
11
  tags '<%= route_resouces %>'
12
12
  produces 'application/vnd.api+json'
13
13
  parameter name: :'page[number]', in: :query, type: :string, description: '<%= t(:page_num) %>', required: false
14
+ <% if relationships.present? -%>
14
15
  parameter name: :include, in: :query, type: :string, description: '<%= t(:include_related_data) %>', required: false
16
+ <% end -%>
15
17
  <% filters.each do |filter_attr, filter_config| -%>
16
18
  parameter name: :'filter[<%= filter_attr %>]', in: :query, type: :string, description: '<%= t(:filter_field) %>', <% if filter_config[:default] -%>default: '<%= safe_encode(filter_config[:default]) %>',<% end %>required: false
17
19
  <% end -%>
@@ -99,7 +101,9 @@ RSpec.describe '<%= resouces_name %>', type: :request do
99
101
  tags '<%= route_resouces %>'
100
102
  produces 'application/vnd.api+json'
101
103
  parameter name: :id, in: :path, type: :integer, description: 'ID', required: true
104
+ <% if relationships.present? -%>
102
105
  parameter name: :include, in: :query, type: :string, description: '<%= t(:include_related_data) %>', required: false
106
+ <% end -%>
103
107
  parameter name: :'fields[<%= route_resouces %>]', in: :query, type: :string, description: '<%= t(:display_field) %>', required: false
104
108
  <% relationships.each_value do |relation| -%>
105
109
  parameter name: :'fields[<%= relation.class_name.tableize %>]', in: :query, type: :string, description: '<%= t(:display_field) %>', required: false
@@ -6,7 +6,7 @@ module Jsonapi
6
6
  initializer 'jsonapi-swagger-i18n' do |app|
7
7
  locates = app.config.i18n.available_locales
8
8
  locates_dir = File.expand_path('../../i18n', __dir__)
9
- locates.each do |loc|
9
+ Array(locates).each do |loc|
10
10
  locate_file = File.join(locates_dir, "#{loc}.yml")
11
11
  I18n.load_path.push(locate_file) if File.exist?(locate_file) && !I18n.load_path.include?(locate_file)
12
12
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jsonapi
4
4
  module Swagger
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-swagger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YingRui Lu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-30 00:00:00.000000000 Z
11
+ date: 2019-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,7 +73,6 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - LICENSE.md
77
76
  - README.md
78
77
  - lib/generators/jsonapi/swagger/USAGE
79
78
  - lib/generators/jsonapi/swagger/swagger_generator.rb
data/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 superiorlu
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.