openapi_blocks 0.3.0 → 0.3.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/CHANGELOG.md +5 -0
- data/README.md +1 -0
- data/README.pt-BR.md +1 -0
- data/lib/openapi_blocks/controller.rb +5 -1
- data/lib/openapi_blocks/routing/extractor.rb +16 -1
- data/lib/openapi_blocks/version.rb +1 -1
- 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: a45ac9389f6202430fb9c21ded74a327d221a9925e5b6a9a3622ea712a216290
|
|
4
|
+
data.tar.gz: bc02bd7c04f7ab2e2c6981b23ca317c500b070bfddb4120808d1b801d300c679
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28ab89af18ab105d20c37ea9882239925d2afba4a8f644fb038d1d93c444fc29b94f4f117429a36e0d6442116fe984c48bafbb37fbef0ebd4131a994e2d04141
|
|
7
|
+
data.tar.gz: a679b294432e62db66c3e3e774d042319aaf4d9371a3e788bcbcedecc3f71906a7b924b04090196c79a608a177a245fb12f545ad272307882e3d3ed459079f67
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.1] - 2026-06-02
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- `OpenapiBlocks::Controller` now uses `controller` to specifies exact controller
|
|
14
|
+
|
|
10
15
|
## [0.3.0] - 2026-06-01
|
|
11
16
|
|
|
12
17
|
### Added
|
data/README.md
CHANGED
data/README.pt-BR.md
CHANGED
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
module OpenapiBlocks
|
|
4
4
|
class Controller # rubocop:disable Style/Documentation
|
|
5
5
|
class << self
|
|
6
|
-
attr_reader :_resource, :_operations, :_tags
|
|
6
|
+
attr_reader :_resource, :_operations, :_tags, :_controller_class
|
|
7
7
|
|
|
8
8
|
def resource(klass)
|
|
9
9
|
@_resource = klass
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
def controller(klass)
|
|
13
|
+
@_controller_class = klass
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
def model
|
|
13
17
|
@_resource&.model
|
|
14
18
|
end
|
|
@@ -180,7 +180,22 @@ module OpenapiBlocks
|
|
|
180
180
|
openapi_name = "#{operation.schema_name}Openapi"
|
|
181
181
|
Object.const_get(openapi_name)
|
|
182
182
|
rescue NameError
|
|
183
|
-
|
|
183
|
+
openapi_classes.find do |klass|
|
|
184
|
+
klass.respond_to?(:_controller_class) && klass._controller_class.present? &&
|
|
185
|
+
controller_name_for(klass._controller_class) == operation.controller
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def openapi_classes
|
|
190
|
+
ObjectSpace.each_object(Class).select do |klass|
|
|
191
|
+
name = Module.instance_method(:name).bind_call(klass)
|
|
192
|
+
name&.end_with?("Openapi") &&
|
|
193
|
+
(klass < OpenapiBlocks::Base || klass < OpenapiBlocks::Controller)
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
def controller_name_for(controller_class)
|
|
198
|
+
controller_class.to_s.delete_suffix("Controller").underscore
|
|
184
199
|
end
|
|
185
200
|
end
|
|
186
201
|
end
|