Class: Gitlab::GrapeOpenapi::Converters::PathConverter
- Inherits:
-
Object
- Object
- Gitlab::GrapeOpenapi::Converters::PathConverter
- Defined in:
- lib/gitlab/grape_openapi/converters/path_converter.rb
Constant Summary collapse
- RESPONSE_DECLARATIONS =
Grape stores response-entity declarations under :entity (when declared via ‘entity:` on the route) and :success (when declared via the `success` DSL inside a `desc` block, in any of its forms). EntityConverter.register handles all three shapes (Class, Hash with :model, Array of those).
%i[entity success].freeze
Class Method Summary collapse
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(routes, schema_registry, request_body_registry) ⇒ PathConverter
constructor
A new instance of PathConverter.
Constructor Details
#initialize(routes, schema_registry, request_body_registry) ⇒ PathConverter
Returns a new instance of PathConverter.
17 18 19 20 21 22 23 |
# File 'lib/gitlab/grape_openapi/converters/path_converter.rb', line 17 def initialize(routes, schema_registry, request_body_registry) @routes = routes @schema_registry = schema_registry @request_body_registry = request_body_registry @config = Gitlab::GrapeOpenapi.configuration @inherited_path_params = {} end |
Class Method Details
.convert(routes, schema_registry, request_body_registry) ⇒ Object
13 14 15 |
# File 'lib/gitlab/grape_openapi/converters/path_converter.rb', line 13 def self.convert(routes, schema_registry, request_body_registry) new(routes, schema_registry, request_body_registry).convert end |
Instance Method Details
#convert ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/gitlab/grape_openapi/converters/path_converter.rb', line 25 def convert register_inherited_path_params paths = grouped_routes.transform_values do |routes_for_path| build_path_item(routes_for_path) end paths.reject { |_path, operations| operations.empty? } end |