Class: GrapeOAS::Exporter::Base::Operation
- Inherits:
-
Object
- Object
- GrapeOAS::Exporter::Base::Operation
- Defined in:
- lib/grape_oas/exporter/base/operation.rb
Overview
Base class for Operation exporters Contains common logic shared between OAS2 and OAS3
Direct Known Subclasses
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(operation, ref_tracker = nil, **options) ⇒ Operation
constructor
A new instance of Operation.
Constructor Details
#initialize(operation, ref_tracker = nil, **options) ⇒ Operation
Returns a new instance of Operation.
9 10 11 12 13 |
# File 'lib/grape_oas/exporter/base/operation.rb', line 9 def initialize(operation, ref_tracker = nil, **) @op = operation @ref_tracker = ref_tracker @options = end |
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/grape_oas/exporter/base/operation.rb', line 15 def build data = build_common_fields # Add version-specific fields data.merge!(build_version_specific_fields) # Add security if present data["security"] = @op.security unless @op.security.nil? || @op.security.empty? # Guarantee a 4xx response for lint rules ensure_default_error_response(data) # Merge extensions data.merge!(@op.extensions) if @op.extensions&.any? data.compact end |