grape 3.3.1 → 3.3.2

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: 8464d92025577bf0a660c5b99780bf51dcbd9f3d7821179dcae7df46f4558a17
4
- data.tar.gz: feb009c07e937353a4296583565157df9a379341250ace82bcbee5f0f6afa7ff
3
+ metadata.gz: 47f5b2c65d5d4fb054f4b602fd97bd02be043e1ae40ded0d52dc70c2888a4ca7
4
+ data.tar.gz: f6bb78e2afc50d777dc0edf0447098908b6532c7e523f0291e693aacbff065c6
5
5
  SHA512:
6
- metadata.gz: d18914103ad6a218dc4abd3bcca9f6cefe7d409aea2c5319da0e796081bfb73470b21195e468033864f01ef7e8cef3afafdad97210b3df4b1d8fb75622b2f4c8
7
- data.tar.gz: e5c4755ff3eb6192db865c555a27f0eeeb2e1bec7a9ef9d9e42ef11606e3feb022785e29d09ad6431a7b3e6745134c22e1504eda02490b69e523bcab98367415
6
+ metadata.gz: 910ad023e4cbfca1ba429adcccaa71018e5bad3f88e2195fe8becb26aa4736ed18b5b87f997e71fa11d4211e817f5b6d2aff518fda31ad93105b6e51c6f4d4b7
7
+ data.tar.gz: 85f489446889da6c3645842672790246e66b636d63af6d3734a8bbaa5163c3ec22086e6e066cda8eac52dfd1c4f4834f4536aab39211585297ab25b1efa4d6d9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 3.3.2 (2026-07-05)
2
+
3
+ #### Fixes
4
+
5
+ * [#2773](https://github.com/ruby-grape/grape/pull/2773): Fix middleware build crash when a top-level `::Options` constant is in scope - [@ericproulx](https://github.com/ericproulx).
6
+ * Your contribution here.
7
+
1
8
  ### 3.3.1 (2026-06-28)
2
9
 
3
10
  #### Fixes
data/README.md CHANGED
@@ -10,7 +10,7 @@ Grape is a REST-like API framework for Ruby. It's designed to run on Rack or com
10
10
 
11
11
  ## Stable Release
12
12
 
13
- You're reading the documentation for the stable release of Grape, 3.3.1.
13
+ You're reading the documentation for the stable release of Grape, 3.3.2.
14
14
 
15
15
  ## Project Resources
16
16
 
@@ -16,10 +16,8 @@ module Grape
16
16
  # subclass's `DEFAULT_OPTIONS` Hash (legacy path) and frozen.
17
17
  def initialize(app, **options)
18
18
  @app = app
19
- if self.class.const_defined?(:Options)
20
- # Search ancestors so subclasses (e.g. Versioner::Path → Versioner::Base)
21
- # inherit their parent's Options Data class without redeclaring it.
22
- @config = self.class::Options.new(**options)
19
+ if (config_class = options_data_class)
20
+ @config = config_class.new(**options)
23
21
  @options = @config.to_h.freeze
24
22
  else
25
23
  @options = merge_default_options(options).freeze
@@ -92,9 +90,25 @@ module Grape
92
90
 
93
91
  def merge_default_options(options)
94
92
  return default_options.deep_merge(options) if respond_to?(:default_options)
95
- return self.class::DEFAULT_OPTIONS.deep_merge(options) if self.class.const_defined?(:DEFAULT_OPTIONS)
96
93
 
97
- options
94
+ default_options_constant&.deep_merge(options) || options
95
+ end
96
+
97
+ # self.class::Options honours middleware inheritance (e.g. Versioner::Path
98
+ # → Versioner::Base) and, unlike const_defined?, never resolves a
99
+ # top-level ::Options on Object. Absent an own/inherited Options class,
100
+ # the lookup raises NameError and we fall back to the legacy path.
101
+ def options_data_class
102
+ self.class::Options
103
+ rescue NameError
104
+ nil
105
+ end
106
+
107
+ # Same idea as {#options_data_class} for the legacy DEFAULT_OPTIONS Hash.
108
+ def default_options_constant
109
+ self.class::DEFAULT_OPTIONS
110
+ rescue NameError
111
+ nil
98
112
  end
99
113
 
100
114
  def try_scrub(obj)
data/lib/grape/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Grape
4
4
  # The current version of Grape.
5
- VERSION = '3.3.1'
5
+ VERSION = '3.3.2'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -281,9 +281,9 @@ licenses:
281
281
  - MIT
282
282
  metadata:
283
283
  bug_tracker_uri: https://github.com/ruby-grape/grape/issues
284
- changelog_uri: https://github.com/ruby-grape/grape/blob/v3.3.1/CHANGELOG.md
285
- documentation_uri: https://www.rubydoc.info/gems/grape/3.3.1
286
- source_code_uri: https://github.com/ruby-grape/grape/tree/v3.3.1
284
+ changelog_uri: https://github.com/ruby-grape/grape/blob/v3.3.2/CHANGELOG.md
285
+ documentation_uri: https://www.rubydoc.info/gems/grape/3.3.2
286
+ source_code_uri: https://github.com/ruby-grape/grape/tree/v3.3.2
287
287
  rubygems_mfa_required: 'true'
288
288
  rdoc_options: []
289
289
  require_paths: