active_model_serializers 0.10.0.rc4 → 0.10.0.rc5
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 +4 -4
- data/.github/ISSUE_TEMPLATE.md +29 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +15 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +19 -1
- data/.rubocop_todo.yml +30 -103
- data/.simplecov +0 -1
- data/.travis.yml +20 -8
- data/CHANGELOG.md +89 -5
- data/CONTRIBUTING.md +54 -179
- data/Gemfile +7 -2
- data/{LICENSE.txt → MIT-LICENSE} +0 -0
- data/README.md +27 -5
- data/Rakefile +44 -16
- data/active_model_serializers.gemspec +9 -1
- data/appveyor.yml +1 -0
- data/bin/bench +171 -0
- data/bin/bench_regression +316 -0
- data/bin/serve_benchmark +39 -0
- data/docs/ARCHITECTURE.md +13 -7
- data/docs/README.md +5 -1
- data/docs/STYLE.md +58 -0
- data/docs/general/adapters.md +99 -16
- data/docs/general/configuration_options.md +87 -14
- data/docs/general/deserialization.md +100 -0
- data/docs/general/getting_started.md +35 -0
- data/docs/general/instrumentation.md +1 -1
- data/docs/general/key_transforms.md +40 -0
- data/docs/general/rendering.md +115 -13
- data/docs/general/serializers.md +138 -6
- data/docs/howto/add_pagination_links.md +36 -18
- data/docs/howto/outside_controller_use.md +4 -4
- data/docs/howto/passing_arbitrary_options.md +27 -0
- data/docs/jsonapi/errors.md +56 -0
- data/docs/jsonapi/schema.md +29 -18
- data/docs/rfcs/0000-namespace.md +106 -0
- data/docs/rfcs/template.md +15 -0
- data/lib/action_controller/serialization.rb +10 -19
- data/lib/active_model/serializable_resource.rb +4 -65
- data/lib/active_model/serializer.rb +73 -18
- data/lib/active_model/serializer/adapter.rb +15 -82
- data/lib/active_model/serializer/adapter/attributes.rb +5 -56
- data/lib/active_model/serializer/adapter/base.rb +5 -47
- data/lib/active_model/serializer/adapter/json.rb +6 -12
- data/lib/active_model/serializer/adapter/json_api.rb +5 -213
- data/lib/active_model/serializer/adapter/null.rb +7 -3
- data/lib/active_model/serializer/array_serializer.rb +3 -3
- data/lib/active_model/serializer/association.rb +4 -5
- data/lib/active_model/serializer/attributes.rb +1 -1
- data/lib/active_model/serializer/caching.rb +56 -5
- data/lib/active_model/serializer/collection_serializer.rb +30 -13
- data/lib/active_model/serializer/configuration.rb +7 -0
- data/lib/active_model/serializer/error_serializer.rb +10 -0
- data/lib/active_model/serializer/errors_serializer.rb +27 -0
- data/lib/active_model/serializer/links.rb +4 -2
- data/lib/active_model/serializer/lint.rb +14 -0
- data/lib/active_model/serializer/meta.rb +29 -0
- data/lib/active_model/serializer/null.rb +17 -0
- data/lib/active_model/serializer/reflection.rb +57 -1
- data/lib/active_model/serializer/type.rb +1 -1
- data/lib/active_model/serializer/version.rb +1 -1
- data/lib/active_model_serializers.rb +17 -0
- data/lib/active_model_serializers/adapter.rb +92 -0
- data/lib/active_model_serializers/adapter/attributes.rb +94 -0
- data/lib/active_model_serializers/adapter/base.rb +90 -0
- data/lib/active_model_serializers/adapter/json.rb +11 -0
- data/lib/active_model_serializers/adapter/json_api.rb +513 -0
- data/lib/active_model_serializers/adapter/json_api/deserialization.rb +213 -0
- data/lib/active_model_serializers/adapter/json_api/error.rb +96 -0
- data/lib/active_model_serializers/adapter/json_api/jsonapi.rb +49 -0
- data/lib/active_model_serializers/adapter/json_api/link.rb +83 -0
- data/lib/active_model_serializers/adapter/json_api/meta.rb +37 -0
- data/lib/active_model_serializers/adapter/json_api/pagination_links.rb +57 -0
- data/lib/active_model_serializers/adapter/json_api/relationship.rb +52 -0
- data/lib/active_model_serializers/adapter/json_api/resource_identifier.rb +37 -0
- data/lib/active_model_serializers/adapter/null.rb +10 -0
- data/lib/active_model_serializers/cached_serializer.rb +87 -0
- data/lib/active_model_serializers/callbacks.rb +1 -1
- data/lib/active_model_serializers/deprecate.rb +55 -0
- data/lib/active_model_serializers/deserialization.rb +2 -2
- data/lib/active_model_serializers/fragment_cache.rb +118 -0
- data/lib/active_model_serializers/json_pointer.rb +14 -0
- data/lib/active_model_serializers/key_transform.rb +70 -0
- data/lib/active_model_serializers/logging.rb +4 -1
- data/lib/active_model_serializers/model.rb +11 -1
- data/lib/active_model_serializers/railtie.rb +9 -1
- data/lib/active_model_serializers/register_jsonapi_renderer.rb +64 -0
- data/lib/active_model_serializers/serializable_resource.rb +81 -0
- data/lib/active_model_serializers/serialization_context.rb +24 -2
- data/lib/active_model_serializers/test/schema.rb +2 -2
- data/lib/grape/formatters/active_model_serializers.rb +1 -1
- data/test/action_controller/adapter_selector_test.rb +1 -1
- data/test/action_controller/json_api/deserialization_test.rb +56 -3
- data/test/action_controller/json_api/errors_test.rb +41 -0
- data/test/action_controller/json_api/linked_test.rb +10 -9
- data/test/action_controller/json_api/pagination_test.rb +2 -2
- data/test/action_controller/json_api/transform_test.rb +180 -0
- data/test/action_controller/serialization_scope_name_test.rb +201 -35
- data/test/action_controller/serialization_test.rb +39 -7
- data/test/active_model_serializers/adapter_for_test.rb +208 -0
- data/test/active_model_serializers/cached_serializer_test.rb +80 -0
- data/test/active_model_serializers/fragment_cache_test.rb +34 -0
- data/test/active_model_serializers/json_pointer_test.rb +20 -0
- data/test/active_model_serializers/key_transform_test.rb +263 -0
- data/test/active_model_serializers/logging_test.rb +8 -8
- data/test/active_model_serializers/railtie_test_isolated.rb +6 -0
- data/test/active_model_serializers/serialization_context_test_isolated.rb +58 -0
- data/test/adapter/deprecation_test.rb +100 -0
- data/test/adapter/json/belongs_to_test.rb +32 -34
- data/test/adapter/json/collection_test.rb +73 -75
- data/test/adapter/json/has_many_test.rb +36 -38
- data/test/adapter/json/transform_test.rb +93 -0
- data/test/adapter/json_api/belongs_to_test.rb +127 -129
- data/test/adapter/json_api/collection_test.rb +80 -82
- data/test/adapter/json_api/errors_test.rb +78 -0
- data/test/adapter/json_api/fields_test.rb +68 -70
- data/test/adapter/json_api/has_many_embed_ids_test.rb +32 -34
- data/test/adapter/json_api/has_many_explicit_serializer_test.rb +75 -77
- data/test/adapter/json_api/has_many_test.rb +121 -123
- data/test/adapter/json_api/has_one_test.rb +59 -61
- data/test/adapter/json_api/json_api_test.rb +28 -30
- data/test/adapter/json_api/linked_test.rb +319 -321
- data/test/adapter/json_api/links_test.rb +75 -50
- data/test/adapter/json_api/pagination_links_test.rb +115 -82
- data/test/adapter/json_api/parse_test.rb +114 -116
- data/test/adapter/json_api/relationship_test.rb +161 -0
- data/test/adapter/json_api/relationships_test.rb +199 -0
- data/test/adapter/json_api/resource_identifier_test.rb +85 -0
- data/test/adapter/json_api/resource_meta_test.rb +100 -0
- data/test/adapter/json_api/toplevel_jsonapi_test.rb +61 -63
- data/test/adapter/json_api/transform_test.rb +500 -0
- data/test/adapter/json_api/type_test.rb +61 -0
- data/test/adapter/json_test.rb +35 -37
- data/test/adapter/null_test.rb +13 -15
- data/test/adapter/polymorphic_test.rb +72 -0
- data/test/adapter_test.rb +27 -29
- data/test/array_serializer_test.rb +7 -8
- data/test/benchmark/app.rb +65 -0
- data/test/benchmark/benchmarking_support.rb +67 -0
- data/test/benchmark/bm_caching.rb +117 -0
- data/test/benchmark/bm_transform.rb +34 -0
- data/test/benchmark/config.ru +3 -0
- data/test/benchmark/controllers.rb +77 -0
- data/test/benchmark/fixtures.rb +167 -0
- data/test/cache_test.rb +388 -0
- data/test/collection_serializer_test.rb +10 -0
- data/test/fixtures/active_record.rb +12 -0
- data/test/fixtures/poro.rb +28 -3
- data/test/grape_test.rb +5 -5
- data/test/lint_test.rb +9 -0
- data/test/serializable_resource_test.rb +59 -3
- data/test/serializers/associations_test.rb +8 -8
- data/test/serializers/attribute_test.rb +7 -7
- data/test/serializers/caching_configuration_test_isolated.rb +170 -0
- data/test/serializers/meta_test.rb +74 -6
- data/test/serializers/read_attribute_for_serialization_test.rb +79 -0
- data/test/serializers/serialization_test.rb +55 -0
- data/test/support/isolated_unit.rb +3 -0
- data/test/support/rails5_shims.rb +26 -8
- data/test/support/rails_app.rb +38 -18
- data/test/support/serialization_testing.rb +5 -5
- data/test/test_helper.rb +6 -10
- metadata +132 -37
- data/docs/DESIGN.textile +7 -1
- data/lib/active_model/serializer/adapter/cached_serializer.rb +0 -45
- data/lib/active_model/serializer/adapter/fragment_cache.rb +0 -111
- data/lib/active_model/serializer/adapter/json/fragment_cache.rb +0 -13
- data/lib/active_model/serializer/adapter/json_api/deserialization.rb +0 -207
- data/lib/active_model/serializer/adapter/json_api/fragment_cache.rb +0 -21
- data/lib/active_model/serializer/adapter/json_api/link.rb +0 -44
- data/lib/active_model/serializer/adapter/json_api/pagination_links.rb +0 -58
- data/test/active_model_serializers/serialization_context_test.rb +0 -18
- data/test/adapter/fragment_cache_test.rb +0 -38
- data/test/adapter/json_api/resource_type_config_test.rb +0 -71
- data/test/serializers/adapter_for_test.rb +0 -166
- data/test/serializers/cache_test.rb +0 -209
- data/test/support/simplecov.rb +0 -6
- data/test/support/stream_capture.rb +0 -50
- data/test/support/test_case.rb +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 79d558ff503a5d3d80c7e28d07fbad6858c87416
|
|
4
|
+
data.tar.gz: e1345a0b533ac95996f62e873366907377f8e175
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ded6c2f6e8a7bbe81543a4939ae02c255908697a3894556bc81b5c46cb21b81cf771370fc60a902d393391b0b3addd9a5018cf142a04ecf3752c2aa1dcab2292
|
|
7
|
+
data.tar.gz: 285de3be1603f3ad013da4813ff3a95528e99bf3b2b4f511e780cefb6babd8d9555b113a3eaca762400e64e941d2fc699de02a73745ff56d7365b9dc6c41957a
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#### Expected behavior vs actual behavior
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
#### Steps to reproduce
|
|
6
|
+
*(e.g., detailed walkthrough, runnable script, example application)*
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
#### Environment
|
|
11
|
+
|
|
12
|
+
ActiveModelSerializers Version *(commit ref if not on tag)*:
|
|
13
|
+
|
|
14
|
+
Output of `ruby -e "puts RUBY_DESCRIPTION"`:
|
|
15
|
+
|
|
16
|
+
OS Type & Version:
|
|
17
|
+
|
|
18
|
+
Integrated application and version *(e.g., Rails, Grape, etc)*:
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
#### Backtrace
|
|
22
|
+
*(e.g., provide any applicable backtraces from your application)*
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
#### Additonal helpful information
|
|
27
|
+
*(e.g., Gemfile.lock, configurations, PR containing a failing test, git bisect results)*
|
|
28
|
+
|
|
29
|
+
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
|
3
3
|
AllCops:
|
|
4
|
+
TargetRubyVersion: 2.2
|
|
4
5
|
Exclude:
|
|
5
6
|
- config/initializers/forbidden_yaml.rb
|
|
6
7
|
- !ruby/regexp /(vendor|bundle|bin|db|tmp)\/.*/
|
|
7
|
-
RunRailsCops: true
|
|
8
8
|
DisplayCopNames: true
|
|
9
9
|
DisplayStyleGuide: true
|
|
10
10
|
|
|
11
|
+
Rails:
|
|
12
|
+
Enabled: true
|
|
13
|
+
|
|
11
14
|
Lint/NestedMethodDefinition:
|
|
12
15
|
Enabled: false
|
|
13
16
|
Exclude:
|
|
14
17
|
- test/action_controller/serialization_test.rb
|
|
15
18
|
|
|
19
|
+
Style/Alias:
|
|
20
|
+
EnforcedStyle: prefer_alias
|
|
21
|
+
|
|
16
22
|
Style/StringLiterals:
|
|
17
23
|
EnforcedStyle: single_quotes
|
|
18
24
|
|
|
@@ -59,6 +65,18 @@ Style/BlockDelimiters:
|
|
|
59
65
|
Enabled: true
|
|
60
66
|
EnforcedStyle: line_count_based
|
|
61
67
|
|
|
68
|
+
Style/SignalException:
|
|
69
|
+
EnforcedStyle: semantic
|
|
70
|
+
|
|
71
|
+
Style/TrailingCommaInLiteral:
|
|
72
|
+
EnforcedStyleForMultiline: no_comma
|
|
73
|
+
|
|
74
|
+
Style/ConditionalAssignment:
|
|
75
|
+
Enabled: false
|
|
76
|
+
|
|
77
|
+
Style/DotPosition:
|
|
78
|
+
EnforcedStyle: leading
|
|
79
|
+
|
|
62
80
|
########## test_helper.rb sanity
|
|
63
81
|
Style/EndBlock:
|
|
64
82
|
Exclude:
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2016-03-08 22:29:52 +0100 using RuboCop version 0.37.2.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
@@ -13,49 +13,31 @@ Lint/HandleExceptions:
|
|
|
13
13
|
|
|
14
14
|
# Offense count: 2
|
|
15
15
|
# Cop supports --auto-correct.
|
|
16
|
-
|
|
17
|
-
Exclude:
|
|
18
|
-
- 'lib/active_model/serializer/adapter/json_api/fragment_cache.rb'
|
|
19
|
-
|
|
20
|
-
# Offense count: 7
|
|
21
|
-
# Cop supports --auto-correct.
|
|
16
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
|
22
17
|
Lint/UnusedMethodArgument:
|
|
23
18
|
Exclude:
|
|
24
|
-
- 'lib/active_model/serializer/adapter/null.rb'
|
|
25
|
-
- 'lib/active_model/serializer/pass_through_serializer.rb'
|
|
26
|
-
- 'test/fixtures/poro.rb'
|
|
27
19
|
- 'test/lint_test.rb'
|
|
28
20
|
|
|
29
|
-
# Offense count: 2
|
|
30
|
-
Lint/UselessAssignment:
|
|
31
|
-
Exclude:
|
|
32
|
-
- 'bench/perf.rb'
|
|
33
|
-
- 'lib/active_model/serializer/adapter/json_api/fragment_cache.rb'
|
|
34
|
-
|
|
35
|
-
# Offense count: 1
|
|
36
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
37
|
-
Rails/Date:
|
|
38
|
-
Exclude:
|
|
39
|
-
- 'test/fixtures/poro.rb'
|
|
40
|
-
|
|
41
21
|
# Offense count: 4
|
|
42
22
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
23
|
+
# SupportedStyles: strict, flexible
|
|
43
24
|
Rails/TimeZone:
|
|
44
25
|
Exclude:
|
|
45
26
|
- 'test/action_controller/serialization_test.rb'
|
|
46
|
-
- 'test/fixtures/poro.rb'
|
|
47
27
|
- 'test/serializers/cache_test.rb'
|
|
48
28
|
|
|
49
29
|
# Offense count: 16
|
|
50
30
|
# Cop supports --auto-correct.
|
|
51
31
|
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
|
|
32
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
52
33
|
Style/AlignHash:
|
|
53
34
|
Exclude:
|
|
54
35
|
- 'test/action_controller/json_api/pagination_test.rb'
|
|
55
36
|
|
|
56
|
-
# Offense count:
|
|
37
|
+
# Offense count: 27
|
|
57
38
|
# Cop supports --auto-correct.
|
|
58
39
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
40
|
+
# SupportedStyles: braces, no_braces, context_dependent
|
|
59
41
|
Style/BracesAroundHashParameters:
|
|
60
42
|
Exclude:
|
|
61
43
|
- 'test/action_controller/adapter_selector_test.rb'
|
|
@@ -67,17 +49,16 @@ Style/BracesAroundHashParameters:
|
|
|
67
49
|
- 'test/collection_serializer_test.rb'
|
|
68
50
|
- 'test/serializable_resource_test.rb'
|
|
69
51
|
- 'test/serializers/associations_test.rb'
|
|
70
|
-
- 'test/serializers/attribute_test.rb'
|
|
71
52
|
- 'test/serializers/attributes_test.rb'
|
|
72
|
-
- 'test/serializers/fieldset_test.rb'
|
|
73
53
|
- 'test/serializers/root_test.rb'
|
|
74
54
|
|
|
75
|
-
# Offense count:
|
|
55
|
+
# Offense count: 271
|
|
76
56
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
57
|
+
# SupportedStyles: nested, compact
|
|
77
58
|
Style/ClassAndModuleChildren:
|
|
78
59
|
Enabled: false
|
|
79
60
|
|
|
80
|
-
# Offense count:
|
|
61
|
+
# Offense count: 6
|
|
81
62
|
# Cop supports --auto-correct.
|
|
82
63
|
Style/CommentIndentation:
|
|
83
64
|
Exclude:
|
|
@@ -89,34 +70,29 @@ Style/DoubleNegation:
|
|
|
89
70
|
- 'lib/active_model/serializable_resource.rb'
|
|
90
71
|
|
|
91
72
|
# Offense count: 1
|
|
92
|
-
Style/EachWithObject:
|
|
93
|
-
Exclude:
|
|
94
|
-
- 'lib/active_model/serializer/fieldset.rb'
|
|
95
|
-
|
|
96
|
-
# Offense count: 2
|
|
97
73
|
# Configuration parameters: MinBodyLength.
|
|
98
74
|
Style/GuardClause:
|
|
99
75
|
Exclude:
|
|
100
76
|
- 'lib/active_model/serializer.rb'
|
|
101
77
|
|
|
102
|
-
# Offense count:
|
|
78
|
+
# Offense count: 58
|
|
103
79
|
# Cop supports --auto-correct.
|
|
104
80
|
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
|
|
81
|
+
# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
|
|
105
82
|
Style/HashSyntax:
|
|
106
83
|
Enabled: false
|
|
107
84
|
|
|
108
|
-
# Offense count:
|
|
85
|
+
# Offense count: 4
|
|
109
86
|
# Cop supports --auto-correct.
|
|
87
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
88
|
+
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
|
110
89
|
Style/IndentArray:
|
|
111
|
-
|
|
112
|
-
- 'test/adapter/json/has_many_test.rb'
|
|
113
|
-
- 'test/adapter/json_api/json_api_test.rb'
|
|
114
|
-
- 'test/adapter/json_api/pagination_links_test.rb'
|
|
115
|
-
- 'test/adapter/json_test.rb'
|
|
90
|
+
Enabled: false
|
|
116
91
|
|
|
117
|
-
# Offense count:
|
|
92
|
+
# Offense count: 10
|
|
118
93
|
# Cop supports --auto-correct.
|
|
119
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
94
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
95
|
+
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
|
120
96
|
Style/IndentHash:
|
|
121
97
|
Enabled: false
|
|
122
98
|
|
|
@@ -129,12 +105,14 @@ Style/Lambda:
|
|
|
129
105
|
# Offense count: 1
|
|
130
106
|
# Cop supports --auto-correct.
|
|
131
107
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
108
|
+
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
|
|
132
109
|
Style/MethodDefParentheses:
|
|
133
110
|
Enabled: false
|
|
134
111
|
|
|
135
|
-
# Offense count:
|
|
112
|
+
# Offense count: 1
|
|
136
113
|
# Cop supports --auto-correct.
|
|
137
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
114
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
|
115
|
+
# SupportedStyles: aligned, indented
|
|
138
116
|
Style/MultilineOperationIndentation:
|
|
139
117
|
Enabled: false
|
|
140
118
|
|
|
@@ -146,45 +124,26 @@ Style/NegatedIf:
|
|
|
146
124
|
|
|
147
125
|
# Offense count: 1
|
|
148
126
|
# Cop supports --auto-correct.
|
|
149
|
-
Style/NumericLiterals:
|
|
150
|
-
MinDigits: 7
|
|
151
|
-
|
|
152
|
-
# Offense count: 2
|
|
153
|
-
# Cop supports --auto-correct.
|
|
154
127
|
Style/PerlBackrefs:
|
|
155
128
|
Exclude:
|
|
156
129
|
- 'test/fixtures/poro.rb'
|
|
157
|
-
- 'test/serializers/associations_test.rb'
|
|
158
130
|
|
|
159
131
|
# Offense count: 3
|
|
160
|
-
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
|
|
132
|
+
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
|
|
133
|
+
# NamePrefix: is_, has_, have_
|
|
134
|
+
# NamePrefixBlacklist: is_, has_, have_
|
|
135
|
+
# NameWhitelist: is_a?
|
|
161
136
|
Style/PredicateName:
|
|
162
137
|
Exclude:
|
|
163
138
|
- 'lib/active_model/serializer/associations.rb'
|
|
164
139
|
- 'test/action_controller/json_api/linked_test.rb'
|
|
165
140
|
|
|
166
|
-
# Offense count:
|
|
141
|
+
# Offense count: 1
|
|
167
142
|
# Cop supports --auto-correct.
|
|
168
143
|
Style/RedundantSelf:
|
|
169
144
|
Exclude:
|
|
170
|
-
- 'lib/active_model/serializer/associations.rb'
|
|
171
145
|
- 'test/fixtures/poro.rb'
|
|
172
146
|
|
|
173
|
-
# Offense count: 1
|
|
174
|
-
# Cop supports --auto-correct.
|
|
175
|
-
# Configuration parameters: AllowAsExpressionSeparator.
|
|
176
|
-
Style/Semicolon:
|
|
177
|
-
Exclude:
|
|
178
|
-
- 'lib/active_model/serializer/fieldset.rb'
|
|
179
|
-
|
|
180
|
-
# Offense count: 3
|
|
181
|
-
# Cop supports --auto-correct.
|
|
182
|
-
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
183
|
-
Style/SignalException:
|
|
184
|
-
Exclude:
|
|
185
|
-
- 'lib/active_model/serializer/fieldset.rb'
|
|
186
|
-
- 'lib/active_model/serializer/pass_through_serializer.rb'
|
|
187
|
-
|
|
188
147
|
# Offense count: 1
|
|
189
148
|
# Cop supports --auto-correct.
|
|
190
149
|
# Configuration parameters: AllowIfMethodIsEmpty.
|
|
@@ -192,49 +151,17 @@ Style/SingleLineMethods:
|
|
|
192
151
|
Exclude:
|
|
193
152
|
- 'test/serializers/serializer_for_test.rb'
|
|
194
153
|
|
|
195
|
-
# Offense count:
|
|
154
|
+
# Offense count: 4
|
|
196
155
|
# Cop supports --auto-correct.
|
|
197
156
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
157
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
198
158
|
Style/StringLiteralsInInterpolation:
|
|
199
159
|
Enabled: false
|
|
200
160
|
|
|
201
|
-
# Offense count: 1
|
|
202
|
-
Style/StructInheritance:
|
|
203
|
-
Exclude:
|
|
204
|
-
- 'bench/perf.rb'
|
|
205
|
-
|
|
206
161
|
# Offense count: 1
|
|
207
162
|
# Cop supports --auto-correct.
|
|
208
|
-
# Configuration parameters: IgnoredMethods.
|
|
209
|
-
Style/SymbolProc:
|
|
210
|
-
Exclude:
|
|
211
|
-
- 'lib/generators/serializer/serializer_generator.rb'
|
|
212
|
-
|
|
213
|
-
# Offense count: 8
|
|
214
|
-
# Cop supports --auto-correct.
|
|
215
163
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
164
|
+
# SupportedStyles: final_newline, final_blank_line
|
|
216
165
|
Style/TrailingBlankLines:
|
|
217
166
|
Exclude:
|
|
218
|
-
- 'lib/active_model/serializer/pass_through_serializer.rb'
|
|
219
|
-
- 'lib/generators/serializer/serializer_generator.rb'
|
|
220
|
-
- 'test/adapter/fragment_cache_test.rb'
|
|
221
|
-
- 'test/adapter/json_api/json_api_test.rb'
|
|
222
167
|
- 'test/adapter/null_test.rb'
|
|
223
|
-
- 'test/serializers/cache_test.rb'
|
|
224
|
-
- 'test/serializers/fieldset_test.rb'
|
|
225
|
-
- 'test/support/stream_capture.rb'
|
|
226
|
-
|
|
227
|
-
# Offense count: 5
|
|
228
|
-
# Cop supports --auto-correct.
|
|
229
|
-
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
|
230
|
-
Style/TrailingComma:
|
|
231
|
-
Exclude:
|
|
232
|
-
- 'test/action_controller/adapter_selector_test.rb'
|
|
233
|
-
- 'test/action_controller/serialization_test.rb'
|
|
234
|
-
- 'test/adapter/json_api/belongs_to_test.rb'
|
|
235
|
-
- 'test/adapter/json_api/linked_test.rb'
|
|
236
|
-
|
|
237
|
-
# Offense count: 1
|
|
238
|
-
Style/UnlessElse:
|
|
239
|
-
Exclude:
|
|
240
|
-
- 'lib/active_model/serializer.rb'
|
data/.simplecov
CHANGED
data/.travis.yml
CHANGED
|
@@ -8,7 +8,11 @@ rvm:
|
|
|
8
8
|
- 2.2.3
|
|
9
9
|
- 2.3.0
|
|
10
10
|
- ruby-head
|
|
11
|
-
-
|
|
11
|
+
- jruby-9.0.4.0
|
|
12
|
+
- jruby-head
|
|
13
|
+
|
|
14
|
+
jdk:
|
|
15
|
+
- oraclejdk8
|
|
12
16
|
|
|
13
17
|
install: bundle install --path=vendor/bundle --retry=3 --jobs=3
|
|
14
18
|
cache:
|
|
@@ -19,10 +23,13 @@ script:
|
|
|
19
23
|
- bundle exec rake ci
|
|
20
24
|
|
|
21
25
|
env:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
global:
|
|
27
|
+
- "JRUBY_OPTS='--dev -J-Xmx1024M --debug'"
|
|
28
|
+
matrix:
|
|
29
|
+
- "RAILS_VERSION=4.0"
|
|
30
|
+
- "RAILS_VERSION=4.1"
|
|
31
|
+
- "RAILS_VERSION=4.2"
|
|
32
|
+
- "RAILS_VERSION=master"
|
|
26
33
|
|
|
27
34
|
matrix:
|
|
28
35
|
exclude:
|
|
@@ -30,10 +37,15 @@ matrix:
|
|
|
30
37
|
env: RAILS_VERSION=master
|
|
31
38
|
- rvm: 2.1
|
|
32
39
|
env: RAILS_VERSION=master
|
|
33
|
-
include:
|
|
34
40
|
- rvm: jruby-9.0.4.0
|
|
35
|
-
env:
|
|
41
|
+
env: RAILS_VERSION=master
|
|
42
|
+
- rvm: jruby-9.0.4.0
|
|
43
|
+
env: RAILS_VERSION=4.0
|
|
44
|
+
- rvm: jruby-head
|
|
45
|
+
env: RAILS_VERSION=master
|
|
46
|
+
- rvm: jruby-head
|
|
47
|
+
env: RAILS_VERSION=4.0
|
|
36
48
|
allow_failures:
|
|
37
49
|
- rvm: ruby-head
|
|
38
|
-
- rvm:
|
|
50
|
+
- rvm: jruby-head
|
|
39
51
|
fast_finish: true
|
data/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,89 @@
|
|
|
1
1
|
## 0.10.x
|
|
2
2
|
|
|
3
|
+
### [v0.10.0.rc5 (2016-04-04)](https://github.com/rails-api/active_model_serializers/compare/v0.10.0.rc4...v0.10.0.rc5)
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
Breaking changes:
|
|
6
|
+
|
|
7
|
+
- [#1645](https://github.com/rails-api/active_model_serializers/pull/1645) Changed :dashed key transform to :dash. (@remear)
|
|
8
|
+
- [#1574](https://github.com/rails-api/active_model_serializers/pull/1574) Default key case for the JsonApi adapter changed to dashed. (@remear)
|
|
9
|
+
|
|
10
|
+
Features:
|
|
11
|
+
- [#1645](https://github.com/rails-api/active_model_serializers/pull/1645) Transform keys referenced in values. (@remear)
|
|
12
|
+
- [#1650](https://github.com/rails-api/active_model_serializers/pull/1650) Fix serialization scope options `scope`, `scope_name`
|
|
13
|
+
take precedence over `serialization_scope` in the controller.
|
|
14
|
+
Fix tests that required tearing down dynamic methods. (@bf4)
|
|
15
|
+
- [#1644](https://github.com/rails-api/active_model_serializers/pull/1644) Include adapter name in cache key so
|
|
16
|
+
that the same serializer can be cached per adapter. (@bf4 via #1346 by @kevintyll)
|
|
17
|
+
- [#1642](https://github.com/rails-api/active_model_serializers/pull/1642) Prefer object.cache_key over the generated
|
|
18
|
+
cache key. (@bf4 via #1346 by @kevintyll)
|
|
19
|
+
- [#1637](https://github.com/rails-api/active_model_serializers/pull/1637) Make references to 'ActionController::Base.cache_store' explicit
|
|
20
|
+
in order to avoid issues when application controllers inherit from 'ActionController::API'. (@ncuesta)
|
|
21
|
+
- [#1633](https://github.com/rails-api/active_model_serializers/pull/1633) Yield 'serializer' to serializer association blocks. (@bf4)
|
|
22
|
+
- [#1616](https://github.com/rails-api/active_model_serializers/pull/1616) SerializableResource handles no serializer like controller. (@bf4)
|
|
23
|
+
- [#1618](https://github.com/rails-api/active_model_serializers/issues/1618) Get collection root key for
|
|
24
|
+
empty collection from explicit serializer option, when possible. (@bf4)
|
|
25
|
+
- [#1574](https://github.com/rails-api/active_model_serializers/pull/1574) Provide key translation. (@remear)
|
|
26
|
+
- [#1494](https://github.com/rails-api/active_model_serializers/pull/1494) Make serializers serializalbe
|
|
27
|
+
(using the Attributes adapter by default). (@bf4)
|
|
28
|
+
- [#1550](https://github.com/rails-api/active_model_serializers/pull/1550) Add
|
|
29
|
+
Rails url_helpers to `SerializationContext` for use in links. (@remear, @bf4)
|
|
30
|
+
- [#1004](https://github.com/rails-api/active_model_serializers/pull/1004) JSON API errors object implementation.
|
|
31
|
+
- Only implements `detail` and `source` as derived from `ActiveModel::Error`
|
|
32
|
+
- Provides checklist of remaining questions and remaining parts of the spec.
|
|
33
|
+
- [#1515](https://github.com/rails-api/active_model_serializers/pull/1515) Adds support for symbols to the
|
|
34
|
+
`ActiveModel::Serializer.type` method. (@groyoh)
|
|
35
|
+
- [#1504](https://github.com/rails-api/active_model_serializers/pull/1504) Adds the changes missing from #1454
|
|
36
|
+
and add more tests for resource identifier and relationship objects. Fix association block with link
|
|
37
|
+
returning `data: nil`.(@groyoh)
|
|
38
|
+
- [#1372](https://github.com/rails-api/active_model_serializers/pull/1372) Support
|
|
39
|
+
cache_store.read_multi. (@LcpMarvel)
|
|
40
|
+
- [#1018](https://github.com/rails-api/active_model_serializers/pull/1018) Add more tests and docs for top-level links. (@leandrocp)
|
|
41
|
+
- [#1454](https://github.com/rails-api/active_model_serializers/pull/1454) Add support for
|
|
42
|
+
relationship-level links and meta attributes. (@beauby)
|
|
43
|
+
- [#1340](https://github.com/rails-api/active_model_serializers/pull/1340) Add support for resource-level meta. (@beauby)
|
|
44
|
+
|
|
45
|
+
Fixes:
|
|
46
|
+
- [#1657](https://github.com/rails-api/active_model_serializers/pull/1657) Add missing missing require "active_support/json". (@andreaseger)
|
|
47
|
+
- [#1661](https://github.com/rails-api/active_model_serializers/pull/1661) Fixes `read_attribute_for_serialization` not
|
|
48
|
+
seeing methods defined in serialization superclass (#1653, #1658, #1660), introduced in #1650. (@bf4)
|
|
49
|
+
- [#1651](https://github.com/rails-api/active_model_serializers/pull/1651) Fix deserialization of nil relationships. (@NullVoxPopuli)
|
|
50
|
+
- [#1480](https://github.com/rails-api/active_model_serializers/pull/1480) Fix setting of cache_store from Rails configuration. (@bf4)
|
|
51
|
+
Fix unintentional mutating of value in memory cache store. (@groyoh)
|
|
52
|
+
- [#1622](https://github.com/rails-api/active_model_serializers/pull/1622) Fragment cache changed from per-record to per-serializer.
|
|
53
|
+
Now, two serializers that use the same model may be separately cached. (@lserman)
|
|
54
|
+
- [#1478](https://github.com/rails-api/active_model_serializers/pull/1478) Cache store will now be correctly set when serializers are
|
|
55
|
+
loaded *before* Rails initializes. (@bf4)
|
|
56
|
+
- [#1570](https://github.com/rails-api/active_model_serializers/pull/1570) Fixed pagination issue with last page size. (@bmorrall)
|
|
57
|
+
- [#1516](https://github.com/rails-api/active_model_serializers/pull/1516) No longer return a nil href when only
|
|
58
|
+
adding meta to a relationship link. (@groyoh)
|
|
59
|
+
- [#1458](https://github.com/rails-api/active_model_serializers/pull/1458) Preserve the serializer
|
|
60
|
+
type when fragment caching. (@bdmac)
|
|
61
|
+
- [#1477](https://github.com/rails-api/active_model_serializers/pull/1477) Fix `fragment_cached?`
|
|
62
|
+
method to check if caching. (@bdmac)
|
|
63
|
+
- [#1501](https://github.com/rails-api/active_model_serializers/pull/1501) Adds tests for SerializableResource::use_adapter?,doc typos (@domitian)
|
|
64
|
+
- [#1488](https://github.com/rails-api/active_model_serializers/pull/1488) Require ActiveSupport's string inflections (@nate00)
|
|
65
|
+
|
|
66
|
+
Misc:
|
|
67
|
+
- [#1608](https://github.com/rails-api/active_model_serializers/pull/1608) Move SerializableResource to ActiveModelSerializers (@groyoh)
|
|
68
|
+
- [#1602](https://github.com/rails-api/active_model_serializers/pull/1602) Add output examples to Adapters docs (@remear)
|
|
69
|
+
- [#1557](https://github.com/rails-api/active_model_serializers/pull/1557) Update docs regarding overriding the root key (@Jwan622)
|
|
70
|
+
- [#1471](https://github.com/rails-api/active_model_serializers/pull/1471) [Cleanup] Serializer caching is its own concern. (@bf4)
|
|
71
|
+
- [#1482](https://github.com/rails-api/active_model_serializers/pull/1482) Document JSON API implementation defs and progress in class. (@bf4)
|
|
72
|
+
- [#1551](https://github.com/rails-api/active_model_serializers/pull/1551) Added codebeat badge (@korzonek)
|
|
73
|
+
- [#1527](https://github.com/rails-api/active_model_serializers/pull/1527) Refactor fragment cache class. (@groyoh)
|
|
74
|
+
- [#1560](https://github.com/rails-api/active_model_serializers/pull/1560) Update rubocop and address its warnings. (@bf4 @groyoh)
|
|
75
|
+
- [#1545](https://github.com/rails-api/active_model_serializers/pull/1545) Document how to pass arbitrary options to the
|
|
76
|
+
serializer (@CodedBeardedSignedTaylor)
|
|
77
|
+
- [#1496](https://github.com/rails-api/active_model_serializers/pull/1496) Run all branches against JRuby on CI (@nadavshatz)
|
|
78
|
+
- [#1559](https://github.com/rails-api/active_model_serializers/pull/1559) Add a deprecation DSL. (@bf4 @groyoh)
|
|
79
|
+
- [#1543](https://github.com/rails-api/active_model_serializers/pull/1543) Add the changes missing from #1535. (@groyoh)
|
|
80
|
+
- [#1535](https://github.com/rails-api/active_model_serializers/pull/1535) Move the adapter and adapter folder to
|
|
81
|
+
active_model_serializers folder and changes the module namespace. (@domitian @bf4)
|
|
82
|
+
- [#1497](https://github.com/rails-api/active_model_serializers/pull/1497) Add JRuby-9000 to appveyor.yml(@corainchicago)
|
|
83
|
+
- [#1420](https://github.com/rails-api/active_model_serializers/pull/1420) Adds tests and documentation for polymorphism(@marcgarreau)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### [v0.10.0.rc4 (2016-01-27)](https://github.com/rails-api/active_model_serializers/compare/v0.10.0.rc3...v0.10.0.rc4)
|
|
5
87
|
Breaking changes:
|
|
6
88
|
|
|
7
89
|
- [#1360](https://github.com/rails-api/active_model_serializers/pull/1360)
|
|
@@ -96,7 +178,7 @@ Misc:
|
|
|
96
178
|
- [#1360](https://github.com/rails-api/active_model_serializers/pull/1360) Update CI to test 2.2.2 -> 2.2.3 (@karaAJC)
|
|
97
179
|
- [#1371](https://github.com/rails-api/active_model_serializers/pull/1371) Refactor, update, create documentation (@bf4)
|
|
98
180
|
|
|
99
|
-
### v0.10.0.rc3 (2015
|
|
181
|
+
### [v0.10.0.rc3 (2015-09-16)](https://github.com/rails-api/active_model_serializers/compare/v0.10.0.rc2...v0.10.0.rc3)
|
|
100
182
|
- [#1129](https://github.com/rails-api/active_model_serializers/pull/1129) Remove SerializableResource.serialize in favor of `.new` (@bf4)
|
|
101
183
|
- [#1155](https://github.com/rails-api/active_model_serializers/pull/1155) Outside controller use tutorial (@CodedBeardedSignedTaylor)
|
|
102
184
|
- [#1154](https://github.com/rails-api/active_model_serializers/pull/1154) Rubocop fixes for issues introduced by #1089 (@NullVoxPopuli)
|
|
@@ -171,7 +253,7 @@ Misc:
|
|
|
171
253
|
- [#965](https://github.com/rails-api/active_model_serializers/pull/965) options fedault valueserializable_hash and as_json (@bf4)
|
|
172
254
|
- [#959](https://github.com/rails-api/active_model_serializers/pull/959) TYPO on README.md (@kangkyu)
|
|
173
255
|
|
|
174
|
-
### v0.10.0.rc2 (2015
|
|
256
|
+
### [v0.10.0.rc2 (2015-06-16)](https://github.com/rails-api/active_model_serializers/compare/v0.10.0.rc1...v0.10.0.rc2)
|
|
175
257
|
- [#958](https://github.com/rails-api/active_model_serializers/pull/958) Splitting json adapter into two (@joaomdmoura)
|
|
176
258
|
* adds FlattenJSON as default adapter
|
|
177
259
|
- [#953](https://github.com/rails-api/active_model_serializers/pull/953) use model name to determine the type (@lsylvester)
|
|
@@ -200,7 +282,7 @@ Misc:
|
|
|
200
282
|
- [#887](https://github.com/rails-api/active_model_serializers/pull/887) Fixing tests on JRuby (@joaomdmoura)
|
|
201
283
|
- [#885](https://github.com/rails-api/active_model_serializers/pull/885) Updates rails versions for test and dev (@tonyta)
|
|
202
284
|
|
|
203
|
-
### v0.10.0.rc1 (2015
|
|
285
|
+
### [v0.10.0.rc1 (2015-04-22)](https://github.com/rails-api/active_model_serializers/compare/86fc7d7227f3ce538fcb28c1e8c7069ce311f0e1...v0.10.0.rc1)
|
|
204
286
|
- [#810](https://github.com/rails-api/active_model_serializers/pull/810) Adding Fragment Cache to AMS (@joaomdmoura)
|
|
205
287
|
* adds fragment cache support
|
|
206
288
|
- [#868](https://github.com/rails-api/active_model_serializers/pull/868) Fixed a bug that appears when a nil association is included (@groyoh)
|
|
@@ -309,6 +391,8 @@ Features:
|
|
|
309
391
|
|
|
310
392
|
* Serializers default namespace can be set in `default_serializer_options` and inherited by associations.
|
|
311
393
|
|
|
394
|
+
* [Beginning of rewrite: c65d387705ec534db171712671ba7fcda4f49f68](https://github.com/rails-api/active_model_serializers/commit/c65d387705ec534db171712671ba7fcda4f49f68)
|
|
395
|
+
|
|
312
396
|
## 0.08.x
|
|
313
397
|
|
|
314
398
|
### v0.8.3 (2014/12/10 14:45 +00:00)
|
|
@@ -410,7 +494,7 @@ Features:
|
|
|
410
494
|
'[Revert the serializers API as other alternatives are now also under discussion](https://github.com/rails/rails/commit/0a4035b12a6c59253cb60f9e3456513c6a6a9d33)'.
|
|
411
495
|
- [Proposed Implementation to Rails 3.2 by @wycats and @josevalim (November 25, 2011)](https://github.com/rails/rails/pull/3753)
|
|
412
496
|
- [Creation of `ActionController::Serialization`, initial serializer
|
|
413
|
-
support (September, 26 2011)](https://github.com/rails/rails/commit/
|
|
497
|
+
support (September, 26 2011)](https://github.com/rails/rails/commit/8ff7693a8dc61f43fc4eaf72ed24d3b8699191fe).
|
|
414
498
|
- [Docs and CHANGELOG](https://github.com/rails/rails/commit/696d01f7f4a8ed787924a41cce6df836cd73c46f)
|
|
415
499
|
- [Deprecation of ActiveModel::Serialization to ActiveModel::Serializable](https://github.com/rails/rails/blob/696d01f7f4a8ed787924a41cce6df836cd73c46f/activemodel/lib/active_model/serialization.rb)
|
|
416
500
|
- [Creation of `ActiveModel::Serialization` from `ActiveModel::Serializer` in Rails (2009)](https://github.com/rails/rails/commit/c6bc8e662614be711f45a8d4b231d5f993b024a7#diff-d029b9768d8df0407a35804a468e3ae5)
|