jsonapi-serializers 1.0.0 → 1.0.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 +5 -5
- data/lib/jsonapi-serializers/serializer.rb +2 -2
- data/lib/jsonapi-serializers/version.rb +1 -1
- data/spec/serializer_spec.rb +14 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0fd9ca8b21d90e0ca99ef6d7c9930e1b6ba9a370e96bf1d0e9cb76b24cf96b34
|
4
|
+
data.tar.gz: '079ac81b6b1a1c99ed075c2479ddd142f3f7db6552a86834201bcb1a0d6de5ff'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfb423c4750432656c8937c52c6dfd0598f32d9548688f5e3b01c90eb08433cb88a29a5dba7bff0c07a91d64a50b0ceae2c416f9f0b14a46254dd315dc992be9
|
7
|
+
data.tar.gz: 9988ef3702519bdc37a40e46f1c9ee28fd1133b94a84f6dfe296feeed668e50f082cd2dd1cb96ed330598e2722d074da4e48808afa41cab81472758cd457d424
|
@@ -304,8 +304,8 @@ module JSONAPI
|
|
304
304
|
|
305
305
|
# Automatically include linkage data for any relation that is also included.
|
306
306
|
if includes
|
307
|
-
|
308
|
-
passthrough_options[:include_linkages] =
|
307
|
+
include_linkages = includes.map { |key| key.to_s.split('.').first }
|
308
|
+
passthrough_options[:include_linkages] = include_linkages
|
309
309
|
end
|
310
310
|
|
311
311
|
# Spec: Primary data MUST be either:
|
data/spec/serializer_spec.rb
CHANGED
@@ -708,7 +708,10 @@ describe JSONAPI::Serializer do
|
|
708
708
|
long_comments.each { |c| c.post = post }
|
709
709
|
|
710
710
|
expected_data = {
|
711
|
-
'data' => serialize_primary(post, {
|
711
|
+
'data' => serialize_primary(post, {
|
712
|
+
serializer: MyApp::PostSerializer,
|
713
|
+
include_linkages: ['long-comments']
|
714
|
+
}),
|
712
715
|
'included' => [
|
713
716
|
# Intermediates are included: long-comments, long-comments.post, and long-comments.post.author
|
714
717
|
# http://jsonapi.org/format/#document-structure-compound-documents
|
@@ -745,7 +748,10 @@ describe JSONAPI::Serializer do
|
|
745
748
|
long_comments.each { |c| c.post = post }
|
746
749
|
|
747
750
|
expected_data = {
|
748
|
-
'data' => serialize_primary(post, {
|
751
|
+
'data' => serialize_primary(post, {
|
752
|
+
serializer: MyApp::PostSerializer,
|
753
|
+
include_linkages: ['long-comments']
|
754
|
+
}),
|
749
755
|
'included' => [
|
750
756
|
serialize_primary(first_comment, {
|
751
757
|
serializer: MyApp::LongCommentSerializer,
|
@@ -788,7 +794,7 @@ describe JSONAPI::Serializer do
|
|
788
794
|
serialize_primary(comment_user, {serializer: MyAppOtherNamespace::UserSerializer}),
|
789
795
|
],
|
790
796
|
}
|
791
|
-
includes = ['long-comments
|
797
|
+
includes = ['long-comments.user']
|
792
798
|
actual_data = JSONAPI::Serializer.serialize(post, include: includes)
|
793
799
|
|
794
800
|
# Multiple expectations for better diff output for debugging.
|
@@ -826,7 +832,7 @@ describe JSONAPI::Serializer do
|
|
826
832
|
],
|
827
833
|
}
|
828
834
|
# Also test that it handles string include arguments.
|
829
|
-
includes = 'long-comments,
|
835
|
+
includes = 'long-comments,long-comments.post.author'
|
830
836
|
actual_data = JSONAPI::Serializer.serialize(post, include: includes)
|
831
837
|
|
832
838
|
# Multiple expectations for better diff output for debugging.
|
@@ -1197,7 +1203,10 @@ describe JSONAPI::Serializer do
|
|
1197
1203
|
long_comments.each { |c| c.post = post }
|
1198
1204
|
|
1199
1205
|
expected_data = {
|
1200
|
-
'data' => serialize_primary(post, {
|
1206
|
+
'data' => serialize_primary(post, {
|
1207
|
+
serializer: Api::V1::MyApp::PostSerializer,
|
1208
|
+
include_linkages: ['long-comments']
|
1209
|
+
}),
|
1201
1210
|
'included' => [
|
1202
1211
|
# Intermediates are included: long-comments, long-comments.post, and long-comments.post.author
|
1203
1212
|
# http://jsonapi.org/format/#document-structure-compound-documents
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi-serializers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Fotinakis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.6
|
140
|
+
rubygems_version: 2.7.6
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Pure Ruby readonly serializers for the JSON:API spec.
|