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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae3a400f492d5ceea5ac3f6cf516b76487f29bba1dd4689d559ebe09d1b38eff
4
- data.tar.gz: 1358b3656b5acd6c516cffa2199e4800474e855d5fa4c52854d1cd73c3eb82da
3
+ metadata.gz: db6f7b71969bf7057afab913332afdde64802ce421a734fc126478aa59e11b54
4
+ data.tar.gz: a23316e534ab62048931a4bd89bd760386f21df2d09da217087870d37f315409
5
5
  SHA512:
6
- metadata.gz: 1661311cfb871028cb7f7020b940cc924f01a05a2dd27e0bd11b8dd090ed57937e940a3a21e23765384fd1ae796929afdd6e9afa171207d86721f323aa591461
7
- data.tar.gz: 9e52fa9aac9e61a5401c2900b55c24405d07101a21126632393e0abfd14b19cffafc25f594e1cdd53f0824192c94e8576ede697e9ebc594aceff35a8ec0fb258
6
+ metadata.gz: bf457042825fc75cd646693ada46332edb446e24238817ee8b046e50ec86dcab12eb630158ac5787fb3bdc74756aaf8f67867d6428c8806d398945c72dc3a6e3
7
+ data.tar.gz: 12b69e7331afa7529ccc7bb213cbd3f3e3892524cf0bdbd632773801dbf0d1bf4fbbf3b6f727a6bd2d34017e1544e08631adb64c9b675c337589dbc24df6f5a5
@@ -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
- if endpoint.respond_to?(:namespace_stackable)
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
- @serializer_class = resource_defined_class
21
- @serializer_class ||= collection_class
22
- @serializer_class ||= options[:serializer]
23
- @serializer_class ||= namespace_inferred_class
24
- @serializer_class ||= version_inferred_class
25
- @serializer_class ||= resource_serializer_class
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
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module ActiveModelSerializers
3
- VERSION = '2.0.0'.freeze
3
+ VERSION = '2.0.1'.freeze
4
4
  end
5
5
  end
@@ -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(
@@ -22,6 +22,7 @@ describe 'Sequel Integration' do
22
22
  let!(:model) {
23
23
  SequelUser = Class.new(Sequel::Model(:users)) do
24
24
  include ActiveModel::Serialization
25
+
25
26
  def self.model_name
26
27
  'User'
27
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-active_model_serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Richard Henry Evans