fast_jsonapi 1.0.17 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +106 -38
- data/lib/extensions/has_one.rb +19 -13
- data/lib/fast_jsonapi.rb +2 -0
- data/lib/fast_jsonapi/instrumentation.rb +2 -0
- data/lib/fast_jsonapi/instrumentation/serializable_hash.rb +15 -0
- data/lib/fast_jsonapi/instrumentation/serialized_json.rb +15 -0
- data/lib/fast_jsonapi/instrumentation/skylight.rb +2 -0
- data/lib/fast_jsonapi/instrumentation/skylight/normalizers/serializable_hash.rb +22 -0
- data/lib/fast_jsonapi/instrumentation/skylight/normalizers/serialized_json.rb +22 -0
- data/lib/fast_jsonapi/multi_to_json.rb +92 -0
- data/lib/fast_jsonapi/object_serializer.rb +120 -91
- data/lib/fast_jsonapi/serialization_core.rb +44 -32
- data/lib/generators/serializer/USAGE +8 -0
- data/lib/generators/serializer/serializer_generator.rb +19 -0
- data/lib/generators/serializer/templates/serializer.rb.tt +6 -0
- metadata +48 -88
- data/.document +0 -5
- data/.rspec +0 -1
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -158
- data/README.rdoc +0 -231
- data/Rakefile +0 -55
- data/VERSION +0 -1
- data/docs/collection_serializer_output.json +0 -35
- data/docs/object_serializer.json +0 -30
- data/fast_jsonapi.gemspec +0 -108
- data/spec/lib/extensions/active_record_spec.rb +0 -67
- data/spec/lib/object_serializer_caching_spec.rb +0 -68
- data/spec/lib/object_serializer_class_methods_spec.rb +0 -69
- data/spec/lib/object_serializer_hyphen_spec.rb +0 -40
- data/spec/lib/object_serializer_performance_spec.rb +0 -87
- data/spec/lib/object_serializer_spec.rb +0 -126
- data/spec/lib/object_serializer_struct_spec.rb +0 -31
- data/spec/lib/serialization_core_spec.rb +0 -84
- data/spec/shared/contexts/ams_context.rb +0 -83
- data/spec/shared/contexts/movie_context.rb +0 -192
- data/spec/spec_helper.rb +0 -15
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators/base'
|
4
|
+
|
5
|
+
class SerializerGenerator < Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path('templates', __dir__)
|
7
|
+
|
8
|
+
argument :attributes, type: :array, default: [], banner: 'field field'
|
9
|
+
|
10
|
+
def create_serializer_file
|
11
|
+
template 'serializer.rb.tt', File.join('app', 'serializers', class_path, "#{file_name}_serializer.rb")
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def attributes_names
|
17
|
+
attributes.map { |a| a.name.to_sym.inspect }
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_jsonapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shishir Kakaraddi
|
@@ -16,58 +16,30 @@ dependencies:
|
|
16
16
|
name: activesupport
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - "
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '5.0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - "~>"
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: '5.0'
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: multi_json
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - "~>"
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '1.12'
|
36
|
-
type: :runtime
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - "~>"
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '1.12'
|
43
|
-
- !ruby/object:Gem::Dependency
|
44
|
-
name: oj
|
45
|
-
requirement: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - "~>"
|
19
|
+
- - ">="
|
48
20
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
21
|
+
version: '4.2'
|
50
22
|
type: :runtime
|
51
23
|
prerelease: false
|
52
24
|
version_requirements: !ruby/object:Gem::Requirement
|
53
25
|
requirements:
|
54
|
-
- - "
|
26
|
+
- - ">="
|
55
27
|
- !ruby/object:Gem::Version
|
56
|
-
version: '
|
28
|
+
version: '4.2'
|
57
29
|
- !ruby/object:Gem::Dependency
|
58
30
|
name: activerecord
|
59
31
|
requirement: !ruby/object:Gem::Requirement
|
60
32
|
requirements:
|
61
|
-
- - "
|
33
|
+
- - ">="
|
62
34
|
- !ruby/object:Gem::Version
|
63
|
-
version: '
|
64
|
-
type: :
|
35
|
+
version: '4.2'
|
36
|
+
type: :development
|
65
37
|
prerelease: false
|
66
38
|
version_requirements: !ruby/object:Gem::Requirement
|
67
39
|
requirements:
|
68
|
-
- - "
|
40
|
+
- - ">="
|
69
41
|
- !ruby/object:Gem::Version
|
70
|
-
version: '
|
42
|
+
version: '4.2'
|
71
43
|
- !ruby/object:Gem::Dependency
|
72
44
|
name: skylight
|
73
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,33 +69,33 @@ dependencies:
|
|
97
69
|
- !ruby/object:Gem::Version
|
98
70
|
version: 3.5.0
|
99
71
|
- !ruby/object:Gem::Dependency
|
100
|
-
name:
|
72
|
+
name: oj
|
101
73
|
requirement: !ruby/object:Gem::Requirement
|
102
74
|
requirements:
|
103
75
|
- - "~>"
|
104
76
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
77
|
+
version: '3.3'
|
106
78
|
type: :development
|
107
79
|
prerelease: false
|
108
80
|
version_requirements: !ruby/object:Gem::Requirement
|
109
81
|
requirements:
|
110
82
|
- - "~>"
|
111
83
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
84
|
+
version: '3.3'
|
113
85
|
- !ruby/object:Gem::Dependency
|
114
|
-
name:
|
86
|
+
name: rspec-benchmark
|
115
87
|
requirement: !ruby/object:Gem::Requirement
|
116
88
|
requirements:
|
117
89
|
- - "~>"
|
118
90
|
- !ruby/object:Gem::Version
|
119
|
-
version:
|
91
|
+
version: 0.3.0
|
120
92
|
type: :development
|
121
93
|
prerelease: false
|
122
94
|
version_requirements: !ruby/object:Gem::Requirement
|
123
95
|
requirements:
|
124
96
|
- - "~>"
|
125
97
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
98
|
+
version: 0.3.0
|
127
99
|
- !ruby/object:Gem::Dependency
|
128
100
|
name: bundler
|
129
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,75 +111,75 @@ dependencies:
|
|
139
111
|
- !ruby/object:Gem::Version
|
140
112
|
version: '1.0'
|
141
113
|
- !ruby/object:Gem::Dependency
|
142
|
-
name:
|
114
|
+
name: byebug
|
143
115
|
requirement: !ruby/object:Gem::Requirement
|
144
116
|
requirements:
|
145
|
-
- - "
|
117
|
+
- - ">="
|
146
118
|
- !ruby/object:Gem::Version
|
147
|
-
version:
|
119
|
+
version: '0'
|
148
120
|
type: :development
|
149
121
|
prerelease: false
|
150
122
|
version_requirements: !ruby/object:Gem::Requirement
|
151
123
|
requirements:
|
152
|
-
- - "
|
124
|
+
- - ">="
|
153
125
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
126
|
+
version: '0'
|
155
127
|
- !ruby/object:Gem::Dependency
|
156
|
-
name:
|
128
|
+
name: active_model_serializers
|
157
129
|
requirement: !ruby/object:Gem::Requirement
|
158
130
|
requirements:
|
159
|
-
- - "
|
131
|
+
- - "~>"
|
160
132
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
133
|
+
version: 0.10.7
|
162
134
|
type: :development
|
163
135
|
prerelease: false
|
164
136
|
version_requirements: !ruby/object:Gem::Requirement
|
165
137
|
requirements:
|
166
|
-
- - "
|
138
|
+
- - "~>"
|
167
139
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
140
|
+
version: 0.10.7
|
169
141
|
- !ruby/object:Gem::Dependency
|
170
|
-
name:
|
142
|
+
name: sqlite3
|
171
143
|
requirement: !ruby/object:Gem::Requirement
|
172
144
|
requirements:
|
173
|
-
- - "
|
145
|
+
- - "~>"
|
174
146
|
- !ruby/object:Gem::Version
|
175
|
-
version: '
|
147
|
+
version: '1.3'
|
176
148
|
type: :development
|
177
149
|
prerelease: false
|
178
150
|
version_requirements: !ruby/object:Gem::Requirement
|
179
151
|
requirements:
|
180
|
-
- - "
|
152
|
+
- - "~>"
|
181
153
|
- !ruby/object:Gem::Version
|
182
|
-
version: '
|
154
|
+
version: '1.3'
|
183
155
|
- !ruby/object:Gem::Dependency
|
184
|
-
name:
|
156
|
+
name: jsonapi-rb
|
185
157
|
requirement: !ruby/object:Gem::Requirement
|
186
158
|
requirements:
|
187
159
|
- - "~>"
|
188
160
|
- !ruby/object:Gem::Version
|
189
|
-
version: 0.
|
161
|
+
version: 0.5.0
|
190
162
|
type: :development
|
191
163
|
prerelease: false
|
192
164
|
version_requirements: !ruby/object:Gem::Requirement
|
193
165
|
requirements:
|
194
166
|
- - "~>"
|
195
167
|
- !ruby/object:Gem::Version
|
196
|
-
version: 0.
|
168
|
+
version: 0.5.0
|
197
169
|
- !ruby/object:Gem::Dependency
|
198
|
-
name:
|
170
|
+
name: jsonapi-serializers
|
199
171
|
requirement: !ruby/object:Gem::Requirement
|
200
172
|
requirements:
|
201
173
|
- - "~>"
|
202
174
|
- !ruby/object:Gem::Version
|
203
|
-
version:
|
175
|
+
version: 1.0.0
|
204
176
|
type: :development
|
205
177
|
prerelease: false
|
206
178
|
version_requirements: !ruby/object:Gem::Requirement
|
207
179
|
requirements:
|
208
180
|
- - "~>"
|
209
181
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
182
|
+
version: 1.0.0
|
211
183
|
description: JSON API(jsonapi.org) serializer that works with rails and can be used
|
212
184
|
to serialize any kind of ruby objects
|
213
185
|
email: ''
|
@@ -216,35 +188,23 @@ extensions: []
|
|
216
188
|
extra_rdoc_files:
|
217
189
|
- LICENSE.txt
|
218
190
|
- README.md
|
219
|
-
- README.rdoc
|
220
191
|
files:
|
221
|
-
- ".document"
|
222
|
-
- ".rspec"
|
223
|
-
- Gemfile
|
224
|
-
- Gemfile.lock
|
225
192
|
- LICENSE.txt
|
226
193
|
- README.md
|
227
|
-
- README.rdoc
|
228
|
-
- Rakefile
|
229
|
-
- VERSION
|
230
|
-
- docs/collection_serializer_output.json
|
231
|
-
- docs/object_serializer.json
|
232
|
-
- fast_jsonapi.gemspec
|
233
194
|
- lib/extensions/has_one.rb
|
234
195
|
- lib/fast_jsonapi.rb
|
196
|
+
- lib/fast_jsonapi/instrumentation.rb
|
197
|
+
- lib/fast_jsonapi/instrumentation/serializable_hash.rb
|
198
|
+
- lib/fast_jsonapi/instrumentation/serialized_json.rb
|
199
|
+
- lib/fast_jsonapi/instrumentation/skylight.rb
|
200
|
+
- lib/fast_jsonapi/instrumentation/skylight/normalizers/serializable_hash.rb
|
201
|
+
- lib/fast_jsonapi/instrumentation/skylight/normalizers/serialized_json.rb
|
202
|
+
- lib/fast_jsonapi/multi_to_json.rb
|
235
203
|
- lib/fast_jsonapi/object_serializer.rb
|
236
204
|
- lib/fast_jsonapi/serialization_core.rb
|
237
|
-
-
|
238
|
-
-
|
239
|
-
-
|
240
|
-
- spec/lib/object_serializer_hyphen_spec.rb
|
241
|
-
- spec/lib/object_serializer_performance_spec.rb
|
242
|
-
- spec/lib/object_serializer_spec.rb
|
243
|
-
- spec/lib/object_serializer_struct_spec.rb
|
244
|
-
- spec/lib/serialization_core_spec.rb
|
245
|
-
- spec/shared/contexts/ams_context.rb
|
246
|
-
- spec/shared/contexts/movie_context.rb
|
247
|
-
- spec/spec_helper.rb
|
205
|
+
- lib/generators/serializer/USAGE
|
206
|
+
- lib/generators/serializer/serializer_generator.rb
|
207
|
+
- lib/generators/serializer/templates/serializer.rb.tt
|
248
208
|
homepage: http://github.com/Netflix/fast_jsonapi
|
249
209
|
licenses:
|
250
210
|
- Apache-2.0
|
@@ -266,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
226
|
version: '0'
|
267
227
|
requirements: []
|
268
228
|
rubyforge_project:
|
269
|
-
rubygems_version: 2.
|
229
|
+
rubygems_version: 2.7.6
|
270
230
|
signing_key:
|
271
231
|
specification_version: 4
|
272
232
|
summary: fast JSON API(jsonapi.org) serializer
|
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,158 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
fast_jsonapi (1.0.16)
|
5
|
-
activerecord (~> 5.0)
|
6
|
-
activesupport (~> 5.0)
|
7
|
-
multi_json (~> 1.12)
|
8
|
-
oj (~> 3.3)
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: https://rubygems.org/
|
12
|
-
specs:
|
13
|
-
actionpack (5.1.4)
|
14
|
-
actionview (= 5.1.4)
|
15
|
-
activesupport (= 5.1.4)
|
16
|
-
rack (~> 2.0)
|
17
|
-
rack-test (>= 0.6.3)
|
18
|
-
rails-dom-testing (~> 2.0)
|
19
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
20
|
-
actionview (5.1.4)
|
21
|
-
activesupport (= 5.1.4)
|
22
|
-
builder (~> 3.1)
|
23
|
-
erubi (~> 1.4)
|
24
|
-
rails-dom-testing (~> 2.0)
|
25
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
26
|
-
active_model_serializers (0.10.7)
|
27
|
-
actionpack (>= 4.1, < 6)
|
28
|
-
activemodel (>= 4.1, < 6)
|
29
|
-
case_transform (>= 0.2)
|
30
|
-
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
31
|
-
activemodel (5.1.4)
|
32
|
-
activesupport (= 5.1.4)
|
33
|
-
activerecord (5.1.4)
|
34
|
-
activemodel (= 5.1.4)
|
35
|
-
activesupport (= 5.1.4)
|
36
|
-
arel (~> 8.0)
|
37
|
-
activesupport (5.1.4)
|
38
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
39
|
-
i18n (~> 0.7)
|
40
|
-
minitest (~> 5.1)
|
41
|
-
tzinfo (~> 1.1)
|
42
|
-
addressable (2.5.2)
|
43
|
-
public_suffix (>= 2.0.2, < 4.0)
|
44
|
-
arel (8.0.0)
|
45
|
-
benchmark-perf (0.2.1)
|
46
|
-
builder (3.2.3)
|
47
|
-
byebug (9.1.0)
|
48
|
-
case_transform (0.2)
|
49
|
-
activesupport
|
50
|
-
concurrent-ruby (1.0.5)
|
51
|
-
crass (1.0.3)
|
52
|
-
descendants_tracker (0.0.4)
|
53
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
54
|
-
diff-lcs (1.3)
|
55
|
-
docile (1.1.5)
|
56
|
-
erubi (1.7.0)
|
57
|
-
faraday (0.12.2)
|
58
|
-
multipart-post (>= 1.2, < 3)
|
59
|
-
git (1.3.0)
|
60
|
-
github_api (0.18.2)
|
61
|
-
addressable (~> 2.4)
|
62
|
-
descendants_tracker (~> 0.0.4)
|
63
|
-
faraday (~> 0.8)
|
64
|
-
hashie (~> 3.5, >= 3.5.2)
|
65
|
-
oauth2 (~> 1.0)
|
66
|
-
hashie (3.5.6)
|
67
|
-
highline (1.7.10)
|
68
|
-
i18n (0.9.1)
|
69
|
-
concurrent-ruby (~> 1.0)
|
70
|
-
json (1.8.6)
|
71
|
-
jsonapi-renderer (0.2.0)
|
72
|
-
juwelier (2.1.3)
|
73
|
-
builder
|
74
|
-
bundler (>= 1.13)
|
75
|
-
git (>= 1.2.5)
|
76
|
-
github_api
|
77
|
-
highline (>= 1.6.15)
|
78
|
-
nokogiri (>= 1.5.10)
|
79
|
-
rake
|
80
|
-
rdoc
|
81
|
-
semver
|
82
|
-
jwt (1.5.6)
|
83
|
-
loofah (2.1.1)
|
84
|
-
crass (~> 1.0.2)
|
85
|
-
nokogiri (>= 1.5.9)
|
86
|
-
mini_portile2 (2.3.0)
|
87
|
-
minitest (5.10.3)
|
88
|
-
multi_json (1.12.2)
|
89
|
-
multi_xml (0.6.0)
|
90
|
-
multipart-post (2.0.0)
|
91
|
-
nokogiri (1.8.1)
|
92
|
-
mini_portile2 (~> 2.3.0)
|
93
|
-
oauth2 (1.4.0)
|
94
|
-
faraday (>= 0.8, < 0.13)
|
95
|
-
jwt (~> 1.0)
|
96
|
-
multi_json (~> 1.3)
|
97
|
-
multi_xml (~> 0.5)
|
98
|
-
rack (>= 1.2, < 3)
|
99
|
-
oj (3.3.9)
|
100
|
-
public_suffix (3.0.1)
|
101
|
-
rack (2.0.3)
|
102
|
-
rack-test (0.8.2)
|
103
|
-
rack (>= 1.0, < 3)
|
104
|
-
rails-dom-testing (2.0.3)
|
105
|
-
activesupport (>= 4.2.0)
|
106
|
-
nokogiri (>= 1.6)
|
107
|
-
rails-html-sanitizer (1.0.3)
|
108
|
-
loofah (~> 2.0)
|
109
|
-
rake (12.3.0)
|
110
|
-
rdoc (3.12.2)
|
111
|
-
json (~> 1.4)
|
112
|
-
rspec (3.5.0)
|
113
|
-
rspec-core (~> 3.5.0)
|
114
|
-
rspec-expectations (~> 3.5.0)
|
115
|
-
rspec-mocks (~> 3.5.0)
|
116
|
-
rspec-benchmark (0.3.0)
|
117
|
-
benchmark-perf (~> 0.2.0)
|
118
|
-
rspec (>= 3.0.0, < 4.0.0)
|
119
|
-
rspec-core (3.5.4)
|
120
|
-
rspec-support (~> 3.5.0)
|
121
|
-
rspec-expectations (3.5.0)
|
122
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
123
|
-
rspec-support (~> 3.5.0)
|
124
|
-
rspec-mocks (3.5.0)
|
125
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
126
|
-
rspec-support (~> 3.5.0)
|
127
|
-
rspec-support (3.5.0)
|
128
|
-
semver (1.0.1)
|
129
|
-
simplecov (0.15.1)
|
130
|
-
docile (~> 1.1.0)
|
131
|
-
json (>= 1.8, < 3)
|
132
|
-
simplecov-html (~> 0.10.0)
|
133
|
-
simplecov-html (0.10.2)
|
134
|
-
skylight (1.5.0)
|
135
|
-
activesupport (>= 3.0.0)
|
136
|
-
sqlite3 (1.3.13)
|
137
|
-
thread_safe (0.3.6)
|
138
|
-
tzinfo (1.2.4)
|
139
|
-
thread_safe (~> 0.1)
|
140
|
-
|
141
|
-
PLATFORMS
|
142
|
-
ruby
|
143
|
-
|
144
|
-
DEPENDENCIES
|
145
|
-
active_model_serializers (~> 0.10.4)
|
146
|
-
bundler (~> 1.0)
|
147
|
-
byebug
|
148
|
-
fast_jsonapi!
|
149
|
-
juwelier (~> 2.1.0)
|
150
|
-
rdoc (~> 3.12)
|
151
|
-
rspec (~> 3.5.0)
|
152
|
-
rspec-benchmark (~> 0.3.0)
|
153
|
-
simplecov
|
154
|
-
skylight (~> 1.3)
|
155
|
-
sqlite3 (~> 1.3)
|
156
|
-
|
157
|
-
BUNDLED WITH
|
158
|
-
1.16.0
|