jsonapi_swagger_helpers 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jsonapi_swagger_helpers.gemspec +1 -0
- data/lib/jsonapi_swagger_helpers/util.rb +17 -3
- data/lib/jsonapi_swagger_helpers/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2574a093a439a865145d7eec98d8eb7f2ffeb3d3
|
4
|
+
data.tar.gz: dbd5a6c8491365bc4b87dcb2e7ceecc6f13e9af6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6b7c645192ebc6aa014516215c3ea832c64d8c0a9fe0da0ba02247711bc4cf927195b5e097802c8e5519fd34e924c01ca8e385732bb7149ebaa61ed3e2a0322
|
7
|
+
data.tar.gz: 98aa67e673653a4df446d070b6157464e1403393a50c2c503053f4758086b81df21d5122135809ebfabcefef56c8340570fc5d74d7505a855ee748331b06d89d
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'swagger-blocks', '~> 1.3'
|
22
22
|
# TODO: above 0.4.2
|
23
23
|
spec.add_dependency 'jsonapi_spec_helpers', ['< 1']
|
24
|
+
spec.add_dependency 'jsonapi_compliable', ['~> 0.10']
|
24
25
|
|
25
26
|
spec.add_development_dependency "bundler", "~> 1.12"
|
26
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -54,10 +54,24 @@ module JsonapiSwaggerHelpers
|
|
54
54
|
memo
|
55
55
|
end
|
56
56
|
|
57
|
+
def self.sideload_hash(sideload, processed = [])
|
58
|
+
if processed.select { |p| p == sideload.name }.length == 1
|
59
|
+
return { sideload.name => {} }
|
60
|
+
end
|
61
|
+
processed << sideload.name
|
62
|
+
|
63
|
+
{ sideload.name => {} }.tap do |hash|
|
64
|
+
sideload.all_sideloads.each_pair do |key, sl|
|
65
|
+
hash[sideload.name][key] = sideload_hash(sl, processed)[key] || {}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
57
70
|
def self.include_directive_for(controller, action)
|
58
71
|
resource_class = controller._jsonapi_compliable
|
59
|
-
|
60
|
-
|
72
|
+
|
73
|
+
includes = sideload_hash(resource_class.sideloading)[:base]
|
74
|
+
whitelist = controller._sideload_whitelist
|
61
75
|
|
62
76
|
if whitelist && whitelist[action]
|
63
77
|
includes = JsonapiCompliable::Util::IncludeParams
|
@@ -72,7 +86,7 @@ module JsonapiSwaggerHelpers
|
|
72
86
|
payloads << JsonapiSpecHelpers::Payload.by_type(resource.config[:type])
|
73
87
|
|
74
88
|
include_hash.each_pair do |name, nested|
|
75
|
-
sideload = resource.sideloading.
|
89
|
+
sideload = resource.sideloading.all_sideloads[name]
|
76
90
|
|
77
91
|
if sideload.polymorphic?
|
78
92
|
sideload.polymorphic_groups.each_pair do |type, sl|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi_swagger_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: swagger-blocks
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "<"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jsonapi_compliable
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.10'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.10'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|