grape_fast_jsonapi 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +66 -66
- data/lib/grape_fast_jsonapi/parser.rb +34 -6
- data/lib/grape_fast_jsonapi/version.rb +1 -1
- data/spec/lib/grape_fast_jsonapi/parser_spec.rb +36 -0
- data/spec/lib/grape_fast_jsonapi/version_spec.rb +1 -1
- data/spec/support/models/db_record.rb +19 -0
- data/spec/support/models/foo.rb +28 -0
- data/spec/support/serializers/db_record_serializer.rb +18 -0
- data/spec/support/serializers/foo_serializer.rb +23 -0
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6026dd876923e91c284ef3c379b4393ec47495485aab633827510601ac0b6355
|
4
|
+
data.tar.gz: 5a43fc86d8e7839774bd5fd56ff2c76fbef8d9d9e20b194c059e12d330ac6117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdc6ee51194b78acda16f8a4bae6d0d0644c2b796918d6786741b055fe3679074735755ff82ac47e8c39cea0152ecd348a5ebbfebb000d4abb4f0b70aa55b1b7
|
7
|
+
data.tar.gz: 9bd438e0174f856064eb568953932fa786c569afbefeb52ea7b8680247e2236a256a945189c9925517f4d5bce8803b800cdbcadf5456a434999fc53e9f82b798
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
-
### v0.2.
|
3
|
+
### v0.2.7 (Next)
|
4
4
|
|
5
5
|
* Your contribution here.
|
6
6
|
|
7
|
+
### v0.2.6 (June 20, 2020)
|
8
|
+
|
9
|
+
* [#14](https://github.com/EmCousin/grape_fast_jsonapi/pull/14) and [#21](https://github.com/EmCousin/grape_fast_jsonapi/pull/21) - Fixes to swagger parser: Respect `:key` setting, fix column type rendering, allow adding to schema - [@vincentvanbush](https://github.com/vincentvanbush) and [@nathanvda](https://github.com/nathanvda)
|
10
|
+
|
7
11
|
### v0.2.5 (January 23, 2020)
|
8
12
|
|
9
13
|
* [#18](https://github.com/EmCousin/grape_fast_jsonapi/pull/18) - Revert to model_name instead of class-name - [@dblommesteijn](https://github.com/dblommesteijn)
|
10
14
|
|
11
15
|
Note : This PR fixes a bug when serializing a ActiveRecord::Relation instance, the formatter was looking for a formatter `ActiveRecord::RelationSerializer` serializer that doesn't exist, insteafd of looking for the serializer corresponding to its model name.
|
12
16
|
|
17
|
+
* Security updates
|
18
|
+
|
13
19
|
### v0.2.4 (December 16, 2019)
|
14
20
|
|
15
21
|
* [#15](https://github.com/EmCousin/grape_fast_jsonapi/pull/15) - Handle serializers which don't have any attributes - [@vesan](https://github.com/vesan)
|
data/Gemfile.lock
CHANGED
@@ -1,70 +1,70 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
grape_fast_jsonapi (0.2.
|
4
|
+
grape_fast_jsonapi (0.2.6)
|
5
5
|
fast_jsonapi (>= 1.5)
|
6
6
|
grape
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.0.2
|
12
|
-
actionpack (= 6.0.2
|
11
|
+
actioncable (6.0.3.2)
|
12
|
+
actionpack (= 6.0.3.2)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.0.2
|
16
|
-
actionpack (= 6.0.2
|
17
|
-
activejob (= 6.0.2
|
18
|
-
activerecord (= 6.0.2
|
19
|
-
activestorage (= 6.0.2
|
20
|
-
activesupport (= 6.0.2
|
15
|
+
actionmailbox (6.0.3.2)
|
16
|
+
actionpack (= 6.0.3.2)
|
17
|
+
activejob (= 6.0.3.2)
|
18
|
+
activerecord (= 6.0.3.2)
|
19
|
+
activestorage (= 6.0.3.2)
|
20
|
+
activesupport (= 6.0.3.2)
|
21
21
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.0.2
|
23
|
-
actionpack (= 6.0.2
|
24
|
-
actionview (= 6.0.2
|
25
|
-
activejob (= 6.0.2
|
22
|
+
actionmailer (6.0.3.2)
|
23
|
+
actionpack (= 6.0.3.2)
|
24
|
+
actionview (= 6.0.3.2)
|
25
|
+
activejob (= 6.0.3.2)
|
26
26
|
mail (~> 2.5, >= 2.5.4)
|
27
27
|
rails-dom-testing (~> 2.0)
|
28
|
-
actionpack (6.0.2
|
29
|
-
actionview (= 6.0.2
|
30
|
-
activesupport (= 6.0.2
|
28
|
+
actionpack (6.0.3.2)
|
29
|
+
actionview (= 6.0.3.2)
|
30
|
+
activesupport (= 6.0.3.2)
|
31
31
|
rack (~> 2.0, >= 2.0.8)
|
32
32
|
rack-test (>= 0.6.3)
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
34
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
-
actiontext (6.0.2
|
36
|
-
actionpack (= 6.0.2
|
37
|
-
activerecord (= 6.0.2
|
38
|
-
activestorage (= 6.0.2
|
39
|
-
activesupport (= 6.0.2
|
35
|
+
actiontext (6.0.3.2)
|
36
|
+
actionpack (= 6.0.3.2)
|
37
|
+
activerecord (= 6.0.3.2)
|
38
|
+
activestorage (= 6.0.3.2)
|
39
|
+
activesupport (= 6.0.3.2)
|
40
40
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (6.0.2
|
42
|
-
activesupport (= 6.0.2
|
41
|
+
actionview (6.0.3.2)
|
42
|
+
activesupport (= 6.0.3.2)
|
43
43
|
builder (~> 3.1)
|
44
44
|
erubi (~> 1.4)
|
45
45
|
rails-dom-testing (~> 2.0)
|
46
46
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
-
activejob (6.0.2
|
48
|
-
activesupport (= 6.0.2
|
47
|
+
activejob (6.0.3.2)
|
48
|
+
activesupport (= 6.0.3.2)
|
49
49
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (6.0.2
|
51
|
-
activesupport (= 6.0.2
|
52
|
-
activerecord (6.0.2
|
53
|
-
activemodel (= 6.0.2
|
54
|
-
activesupport (= 6.0.2
|
55
|
-
activestorage (6.0.2
|
56
|
-
actionpack (= 6.0.2
|
57
|
-
activejob (= 6.0.2
|
58
|
-
activerecord (= 6.0.2
|
50
|
+
activemodel (6.0.3.2)
|
51
|
+
activesupport (= 6.0.3.2)
|
52
|
+
activerecord (6.0.3.2)
|
53
|
+
activemodel (= 6.0.3.2)
|
54
|
+
activesupport (= 6.0.3.2)
|
55
|
+
activestorage (6.0.3.2)
|
56
|
+
actionpack (= 6.0.3.2)
|
57
|
+
activejob (= 6.0.3.2)
|
58
|
+
activerecord (= 6.0.3.2)
|
59
59
|
marcel (~> 0.3.1)
|
60
|
-
activesupport (6.0.2
|
60
|
+
activesupport (6.0.3.2)
|
61
61
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
62
|
i18n (>= 0.7, < 2)
|
63
63
|
minitest (~> 5.1)
|
64
64
|
tzinfo (~> 1.1)
|
65
|
-
zeitwerk (~> 2.2)
|
65
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
66
66
|
builder (3.2.4)
|
67
|
-
concurrent-ruby (1.1.
|
67
|
+
concurrent-ruby (1.1.6)
|
68
68
|
crass (1.0.6)
|
69
69
|
diff-lcs (1.3)
|
70
70
|
dry-configurable (0.9.0)
|
@@ -100,55 +100,55 @@ GEM
|
|
100
100
|
mustermann-grape (~> 1.0.0)
|
101
101
|
rack (>= 1.3.0)
|
102
102
|
rack-accept
|
103
|
-
i18n (1.8.
|
103
|
+
i18n (1.8.3)
|
104
104
|
concurrent-ruby (~> 1.0)
|
105
|
-
loofah (2.
|
105
|
+
loofah (2.6.0)
|
106
106
|
crass (~> 1.0.2)
|
107
107
|
nokogiri (>= 1.5.9)
|
108
108
|
mail (2.7.1)
|
109
109
|
mini_mime (>= 0.1.1)
|
110
110
|
marcel (0.3.3)
|
111
111
|
mimemagic (~> 0.3.2)
|
112
|
-
method_source (0.
|
113
|
-
mimemagic (0.3.
|
112
|
+
method_source (1.0.0)
|
113
|
+
mimemagic (0.3.5)
|
114
114
|
mini_mime (1.0.2)
|
115
115
|
mini_portile2 (2.4.0)
|
116
|
-
minitest (5.14.
|
116
|
+
minitest (5.14.1)
|
117
117
|
mustermann (1.1.1)
|
118
118
|
ruby2_keywords (~> 0.0.1)
|
119
119
|
mustermann-grape (1.0.1)
|
120
120
|
mustermann (>= 1.0.0)
|
121
121
|
nio4r (2.5.2)
|
122
|
-
nokogiri (1.10.
|
122
|
+
nokogiri (1.10.9)
|
123
123
|
mini_portile2 (~> 2.4.0)
|
124
|
-
rack (2.
|
124
|
+
rack (2.2.3)
|
125
125
|
rack-accept (0.4.5)
|
126
126
|
rack (>= 0.4)
|
127
127
|
rack-test (1.1.0)
|
128
128
|
rack (>= 1.0, < 3)
|
129
|
-
rails (6.0.2
|
130
|
-
actioncable (= 6.0.2
|
131
|
-
actionmailbox (= 6.0.2
|
132
|
-
actionmailer (= 6.0.2
|
133
|
-
actionpack (= 6.0.2
|
134
|
-
actiontext (= 6.0.2
|
135
|
-
actionview (= 6.0.2
|
136
|
-
activejob (= 6.0.2
|
137
|
-
activemodel (= 6.0.2
|
138
|
-
activerecord (= 6.0.2
|
139
|
-
activestorage (= 6.0.2
|
140
|
-
activesupport (= 6.0.2
|
129
|
+
rails (6.0.3.2)
|
130
|
+
actioncable (= 6.0.3.2)
|
131
|
+
actionmailbox (= 6.0.3.2)
|
132
|
+
actionmailer (= 6.0.3.2)
|
133
|
+
actionpack (= 6.0.3.2)
|
134
|
+
actiontext (= 6.0.3.2)
|
135
|
+
actionview (= 6.0.3.2)
|
136
|
+
activejob (= 6.0.3.2)
|
137
|
+
activemodel (= 6.0.3.2)
|
138
|
+
activerecord (= 6.0.3.2)
|
139
|
+
activestorage (= 6.0.3.2)
|
140
|
+
activesupport (= 6.0.3.2)
|
141
141
|
bundler (>= 1.3.0)
|
142
|
-
railties (= 6.0.2
|
142
|
+
railties (= 6.0.3.2)
|
143
143
|
sprockets-rails (>= 2.0.0)
|
144
144
|
rails-dom-testing (2.0.3)
|
145
145
|
activesupport (>= 4.2.0)
|
146
146
|
nokogiri (>= 1.6)
|
147
147
|
rails-html-sanitizer (1.3.0)
|
148
148
|
loofah (~> 2.3)
|
149
|
-
railties (6.0.2
|
150
|
-
actionpack (= 6.0.2
|
151
|
-
activesupport (= 6.0.2
|
149
|
+
railties (6.0.3.2)
|
150
|
+
actionpack (= 6.0.3.2)
|
151
|
+
activesupport (= 6.0.3.2)
|
152
152
|
method_source
|
153
153
|
rake (>= 0.8.7)
|
154
154
|
thor (>= 0.20.3, < 2.0)
|
@@ -167,7 +167,7 @@ GEM
|
|
167
167
|
rspec-support (~> 3.9.0)
|
168
168
|
rspec-support (3.9.2)
|
169
169
|
ruby2_keywords (0.0.2)
|
170
|
-
sprockets (4.0.
|
170
|
+
sprockets (4.0.2)
|
171
171
|
concurrent-ruby (~> 1.0)
|
172
172
|
rack (> 1, < 3)
|
173
173
|
sprockets-rails (3.2.1)
|
@@ -176,12 +176,12 @@ GEM
|
|
176
176
|
sprockets (>= 3.0.0)
|
177
177
|
thor (1.0.1)
|
178
178
|
thread_safe (0.3.6)
|
179
|
-
tzinfo (1.2.
|
179
|
+
tzinfo (1.2.7)
|
180
180
|
thread_safe (~> 0.1)
|
181
|
-
websocket-driver (0.7.
|
181
|
+
websocket-driver (0.7.2)
|
182
182
|
websocket-extensions (>= 0.1.0)
|
183
|
-
websocket-extensions (0.1.
|
184
|
-
zeitwerk (2.
|
183
|
+
websocket-extensions (0.1.5)
|
184
|
+
zeitwerk (2.3.0)
|
185
185
|
|
186
186
|
PLATFORMS
|
187
187
|
ruby
|
@@ -194,4 +194,4 @@ DEPENDENCIES
|
|
194
194
|
rspec (~> 3.7)
|
195
195
|
|
196
196
|
BUNDLED WITH
|
197
|
-
1.
|
197
|
+
2.1.2
|
@@ -15,18 +15,27 @@ module GrapeSwagger
|
|
15
15
|
schema = default_schema
|
16
16
|
|
17
17
|
attributes_hash = if (defined? ActiveRecord)
|
18
|
-
map_active_record_columns_to_attributes
|
18
|
+
map_model_attributes.symbolize_keys.merge(map_active_record_columns_to_attributes.symbolize_keys)
|
19
19
|
else
|
20
|
-
map_model_attributes
|
20
|
+
map_model_attributes.symbolize_keys
|
21
21
|
end
|
22
22
|
|
23
23
|
attributes_hash.each do |attribute, type|
|
24
24
|
schema[:data][:properties][:attributes][:properties][attribute] = { type: type }
|
25
|
-
|
25
|
+
example_method = "#{type}_example"
|
26
|
+
unless self.respond_to?(example_method, true)
|
27
|
+
puts "WARN unexpected type encountered, missing #{example_method} --use string example instead"
|
28
|
+
example_method = "string_example"
|
29
|
+
end
|
30
|
+
schema[:data][:example][:attributes][attribute] = send example_method
|
26
31
|
end
|
27
32
|
|
28
33
|
relationships_hash = model.relationships_to_serialize || []
|
29
34
|
|
35
|
+
# If relationship has :key set different than association name, it should be rendered under that key
|
36
|
+
relationships_hash =
|
37
|
+
relationships_hash.each_with_object({}) { |(_relationship_name, relationship), accu| accu[relationship.key] = relationship }
|
38
|
+
|
30
39
|
relationships_hash.each do |model_type, relationship_data|
|
31
40
|
relationships_attributes = relationship_data.instance_values.symbolize_keys
|
32
41
|
schema[:data][:properties][:relationships][:properties][model_type] = {
|
@@ -36,6 +45,8 @@ module GrapeSwagger
|
|
36
45
|
schema[:data][:example][:relationships][model_type] = relationships_example(relationships_attributes)
|
37
46
|
end
|
38
47
|
|
48
|
+
schema.deep_merge!(model.additional_schema) if model.respond_to? :additional_schema
|
49
|
+
|
39
50
|
schema
|
40
51
|
end
|
41
52
|
|
@@ -67,10 +78,10 @@ module GrapeSwagger
|
|
67
78
|
|
68
79
|
def map_active_record_columns_to_attributes
|
69
80
|
activerecord_model = model.record_type.to_s.camelize.safe_constantize
|
70
|
-
return map_model_attributes unless activerecord_model
|
81
|
+
return map_model_attributes unless activerecord_model && activerecord_model < ActiveRecord::Base
|
71
82
|
|
72
83
|
columns = activerecord_model.columns.select do |c|
|
73
|
-
|
84
|
+
model.attributes_to_serialize.keys.include?(c.name.to_sym)
|
74
85
|
end
|
75
86
|
|
76
87
|
attributes = {}
|
@@ -84,7 +95,12 @@ module GrapeSwagger
|
|
84
95
|
def map_model_attributes
|
85
96
|
attributes = {}
|
86
97
|
(model.attributes_to_serialize || []).each do |attribute, _|
|
87
|
-
attributes[attribute] =
|
98
|
+
attributes[attribute] =
|
99
|
+
if model.respond_to? :attribute_types
|
100
|
+
model.attribute_types[attribute] || :string
|
101
|
+
else
|
102
|
+
:string
|
103
|
+
end
|
88
104
|
end
|
89
105
|
attributes
|
90
106
|
end
|
@@ -147,6 +163,14 @@ module GrapeSwagger
|
|
147
163
|
end
|
148
164
|
end
|
149
165
|
|
166
|
+
def citext_example
|
167
|
+
text_example
|
168
|
+
end
|
169
|
+
|
170
|
+
def float_example
|
171
|
+
rand() * rand(1..100)
|
172
|
+
end
|
173
|
+
|
150
174
|
def date_example
|
151
175
|
Date.today.to_s
|
152
176
|
end
|
@@ -173,6 +197,10 @@ module GrapeSwagger
|
|
173
197
|
def boolean_example
|
174
198
|
[true, false].sample
|
175
199
|
end
|
200
|
+
|
201
|
+
def uuid_example
|
202
|
+
SecureRandom.uuid
|
203
|
+
end
|
176
204
|
end
|
177
205
|
end
|
178
206
|
end
|
@@ -126,6 +126,42 @@ describe GrapeSwagger::FastJsonapi::Parser do
|
|
126
126
|
})
|
127
127
|
end
|
128
128
|
end
|
129
|
+
|
130
|
+
context 'when schema has an association with :key different than association name' do
|
131
|
+
let(:model) { FooSerializer }
|
132
|
+
|
133
|
+
it 'includes associations as defined by :key attributes' do
|
134
|
+
expect(subject[:data][:properties][:relationships][:properties]).to include(:foo_bar, :foo_fizz, :foo_buzzes)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
context 'when serializer has additional schema specified' do
|
139
|
+
let(:model) { FooSerializer }
|
140
|
+
|
141
|
+
it 'is deep-merged into the returned schema' do
|
142
|
+
expect(subject[:data][:example][:attributes]).to include(xyz: 'foobar')
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'when serializer has DB-backed model' do
|
147
|
+
let(:model) { DbRecordSerializer }
|
148
|
+
|
149
|
+
before { allow(SecureRandom).to receive(:uuid).and_return 'fakeuuid' }
|
150
|
+
|
151
|
+
it 'contains examples for corresponding data types' do
|
152
|
+
expect(subject[:data][:example][:attributes]).to include(
|
153
|
+
string_attribute: be_a(String),
|
154
|
+
uuid_attribute: 'fakeuuid',
|
155
|
+
integer_attribute: be_a(Integer),
|
156
|
+
text_attribute: be_a(String),
|
157
|
+
datetime_attribute: satisfy { |val| Time.parse(val).is_a? Time },
|
158
|
+
date_attribute: satisfy { |val| Date.parse(val).is_a? Date },
|
159
|
+
boolean_attribute: be_a(TrueClass).or(be_a(FalseClass)),
|
160
|
+
array_attribute: be_a(Array)
|
161
|
+
)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
129
165
|
context 'when the serializer doesn\'t have any attributes' do
|
130
166
|
let(:model) { AnotherBlogPostSerializer } # no attributes
|
131
167
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class DbRecord < ActiveRecord::Base
|
5
|
+
def self.columns
|
6
|
+
[
|
7
|
+
# adhering to the ActiveRecord::ConnectionAdapters::Column contract
|
8
|
+
OpenStruct.new(name: 'id', sql_type: 'integer', type: :integer),
|
9
|
+
OpenStruct.new(name: 'string_attribute', sql_type: 'character varying(255)', type: :string),
|
10
|
+
OpenStruct.new(name: 'uuid_attribute', sql_type: 'uuid', type: :uuid),
|
11
|
+
OpenStruct.new(name: 'integer_attribute', sql_type: 'integer', type: :integer),
|
12
|
+
OpenStruct.new(name: 'text_attribute', sql_type: 'text', type: :text),
|
13
|
+
OpenStruct.new(name: 'datetime_attribute', sql_type: 'timestamp without time zone', type: :datetime),
|
14
|
+
OpenStruct.new(name: 'date_attribute', sql_type: 'date', type: :date),
|
15
|
+
OpenStruct.new(name: 'boolean_attribute', sql_type: 'boolean', type: :boolean),
|
16
|
+
OpenStruct.new(name: 'array_attribute', sql_type: 'integer[]', type: :array)
|
17
|
+
]
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Foo
|
4
|
+
include ActiveModel::Serialization
|
5
|
+
|
6
|
+
attr_accessor :id, :bar_id
|
7
|
+
|
8
|
+
# belongs_to :bar
|
9
|
+
# has_one :fizz
|
10
|
+
# has_many :buzzes
|
11
|
+
|
12
|
+
def initialize(params = {})
|
13
|
+
params.each do |k, v|
|
14
|
+
instance_variable_set("@#{k}", v) unless v.nil?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def attributes
|
19
|
+
{
|
20
|
+
'id' => nil,
|
21
|
+
'bar_id' => nil
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def buzz_ids
|
26
|
+
[]
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_record'
|
4
|
+
|
5
|
+
class DbRecordSerializer
|
6
|
+
include FastJsonapi::ObjectSerializer
|
7
|
+
|
8
|
+
attributes(
|
9
|
+
:string_attribute,
|
10
|
+
:uuid_attribute,
|
11
|
+
:integer_attribute,
|
12
|
+
:text_attribute,
|
13
|
+
:datetime_attribute,
|
14
|
+
:date_attribute,
|
15
|
+
:boolean_attribute,
|
16
|
+
:array_attribute
|
17
|
+
)
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class FooSerializer
|
4
|
+
include FastJsonapi::ObjectSerializer
|
5
|
+
|
6
|
+
belongs_to :bar, key: :foo_bar
|
7
|
+
has_one :fizz, key: :foo_fizz
|
8
|
+
has_many :buzzes, key: :foo_buzzes
|
9
|
+
|
10
|
+
attribute :xyz
|
11
|
+
|
12
|
+
def self.additional_schema
|
13
|
+
{
|
14
|
+
data: {
|
15
|
+
example: {
|
16
|
+
attributes: {
|
17
|
+
xyz: 'foobar'
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape_fast_jsonapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emmanuel Cousin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
@@ -93,11 +93,15 @@ files:
|
|
93
93
|
- spec/lib/grape_fast_jsonapi/version_spec.rb
|
94
94
|
- spec/spec_helper.rb
|
95
95
|
- spec/support/models/blog_post.rb
|
96
|
+
- spec/support/models/db_record.rb
|
97
|
+
- spec/support/models/foo.rb
|
96
98
|
- spec/support/models/user.rb
|
97
99
|
- spec/support/models/user_admin.rb
|
98
100
|
- spec/support/serializers/another_blog_post_serializer.rb
|
99
101
|
- spec/support/serializers/another_user_serializer.rb
|
100
102
|
- spec/support/serializers/blog_post_serializer.rb
|
103
|
+
- spec/support/serializers/db_record_serializer.rb
|
104
|
+
- spec/support/serializers/foo_serializer.rb
|
101
105
|
- spec/support/serializers/user_serializer.rb
|
102
106
|
homepage: https://github.com/EmCousin/grape_fast_jsonapi
|
103
107
|
licenses:
|
@@ -118,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
122
|
- !ruby/object:Gem::Version
|
119
123
|
version: '0'
|
120
124
|
requirements: []
|
121
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.1.2
|
122
126
|
signing_key:
|
123
127
|
specification_version: 4
|
124
128
|
summary: Use fast_jsonapi in grape
|
@@ -128,9 +132,13 @@ test_files:
|
|
128
132
|
- spec/lib/grape_fast_jsonapi/version_spec.rb
|
129
133
|
- spec/spec_helper.rb
|
130
134
|
- spec/support/models/blog_post.rb
|
135
|
+
- spec/support/models/db_record.rb
|
136
|
+
- spec/support/models/foo.rb
|
131
137
|
- spec/support/models/user.rb
|
132
138
|
- spec/support/models/user_admin.rb
|
133
139
|
- spec/support/serializers/another_blog_post_serializer.rb
|
134
140
|
- spec/support/serializers/another_user_serializer.rb
|
135
141
|
- spec/support/serializers/blog_post_serializer.rb
|
142
|
+
- spec/support/serializers/db_record_serializer.rb
|
143
|
+
- spec/support/serializers/foo_serializer.rb
|
136
144
|
- spec/support/serializers/user_serializer.rb
|