grape-active_model_serializers 2.0.0 → 2.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 +4 -4
- data/.github/workflows/ci.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/lib/grape-active_model_serializers/options_builder.rb +1 -5
- data/lib/grape-active_model_serializers/serializer_resolver.rb +8 -6
- data/lib/grape-active_model_serializers/version.rb +1 -1
- data/spec/grape/active_model_serializers/serializer_resolver_spec.rb +12 -0
- data/spec/integration/sequel_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: db6f7b71969bf7057afab913332afdde64802ce421a734fc126478aa59e11b54
|
|
4
|
+
data.tar.gz: a23316e534ab62048931a4bd89bd760386f21df2d09da217087870d37f315409
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bf457042825fc75cd646693ada46332edb446e24238817ee8b046e50ec86dcab12eb630158ac5787fb3bdc74756aaf8f67867d6428c8806d398945c72dc3a6e3
|
|
7
|
+
data.tar.gz: 12b69e7331afa7529ccc7bb213cbd3f3e3892524cf0bdbd632773801dbf0d1bf4fbbf3b6f727a6bd2d34017e1544e08631adb64c9b675c337589dbc24df6f5a5
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -22,6 +22,7 @@ jobs:
|
|
|
22
22
|
strategy:
|
|
23
23
|
matrix:
|
|
24
24
|
ruby-version: [3.4.4, 3.3.8, 3.2.8, 3.1.7]
|
|
25
|
+
grape-version: ['~> 2.3.0', '~> 3.0']
|
|
25
26
|
steps:
|
|
26
27
|
- uses: actions/checkout@v4
|
|
27
28
|
- uses: ruby/setup-ruby@v1
|
|
@@ -29,5 +30,9 @@ jobs:
|
|
|
29
30
|
ruby-version: ${{ matrix.ruby-version }}
|
|
30
31
|
- name: Install dependencies
|
|
31
32
|
run: bundle install --jobs 4 --retry 3
|
|
33
|
+
env:
|
|
34
|
+
GRAPE_VERSION: ${{ matrix.grape-version }}
|
|
32
35
|
- name: Run tests
|
|
33
36
|
run: bundle exec rake
|
|
37
|
+
env:
|
|
38
|
+
GRAPE_VERSION: ${{ matrix.grape-version }}
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 2.0.1 (2025/12/08)
|
|
4
|
+
|
|
5
|
+
* [#92](https://github.com/ruby-grape/grape-active_model_serializers/pull/92): Fix: accept nil serializer - [@mateusnava](https://github.com/mateusnava).
|
|
6
|
+
* [#100](https://github.com/ruby-grape/grape-active_model_serializers/pull/100): Fix compatibility with Grape 3.0 and test in CI - [@samsonjs](https://github.com/samsonjs).
|
|
7
|
+
|
|
3
8
|
### 2.0.0 (2025/06/02)
|
|
4
9
|
|
|
5
10
|
* [#96](https://github.com/ruby-grape/grape-active_model_serializers/pull/96): Add compatibility for Grape 2.3 - [@samsonjs](https://github.com/samsonjs).
|
|
@@ -49,11 +49,7 @@ module Grape
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def innermost_scope
|
|
52
|
-
|
|
53
|
-
endpoint.namespace_stackable(:namespace).last
|
|
54
|
-
else
|
|
55
|
-
endpoint.settings.peek[:namespace]
|
|
56
|
-
end
|
|
52
|
+
endpoint.inheritable_setting.namespace_stackable[:namespace]&.last
|
|
57
53
|
end
|
|
58
54
|
|
|
59
55
|
def meta_options
|
|
@@ -17,12 +17,14 @@ module Grape
|
|
|
17
17
|
def serializer_class
|
|
18
18
|
return @serializer_class if defined?(@serializer_class)
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@serializer_class
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
return nil if options.key?(:serializer) && options[:serializer].nil?
|
|
21
|
+
|
|
22
|
+
@serializer_class = resource_defined_class ||
|
|
23
|
+
collection_class ||
|
|
24
|
+
options[:serializer] ||
|
|
25
|
+
namespace_inferred_class ||
|
|
26
|
+
version_inferred_class ||
|
|
27
|
+
resource_serializer_class
|
|
26
28
|
end
|
|
27
29
|
|
|
28
30
|
def serializer_options
|
|
@@ -52,6 +52,18 @@ describe Grape::ActiveModelSerializers::SerializerResolver do
|
|
|
52
52
|
expect(serializer).to be_kind_of(serializer_class)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
context 'specified nil by options' do
|
|
56
|
+
let(:options) {
|
|
57
|
+
super().merge(
|
|
58
|
+
serializer: nil
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
it 'returns nil' do
|
|
63
|
+
expect(serializer).to be_nil
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
55
67
|
context 'each serializer' do
|
|
56
68
|
let(:options) {
|
|
57
69
|
super().except(:serializer).merge(
|