Class: SoberSwag::Reporting::Output::Referenced
- Defined in:
- lib/sober_swag/reporting/output/referenced.rb
Overview
Referenced: An input that will be referred to via reference in the final schema.
Instance Attribute Summary collapse
-
#output ⇒ Interface
readonly
The actual output type to use.
-
#reference ⇒ String
readonly
Key in the components hash.
Instance Method Summary collapse
- #call(input) ⇒ Object
-
#initialize(output, reference) ⇒ Referenced
constructor
A new instance of Referenced.
- #ref_path ⇒ Object
- #serialize_report(input) ⇒ Object
- #swagger_schema ⇒ Object
Methods inherited from Base
Methods included from Interface
#call!, #described, #enum, #in_range, #list, #nilable, #partitioned, #referenced, #reporting?, #serialize, #via_map
Constructor Details
#initialize(output, reference) ⇒ Referenced
Returns a new instance of Referenced.
8 9 10 11 |
# File 'lib/sober_swag/reporting/output/referenced.rb', line 8 def initialize(output, reference) @output = output @reference = reference end |
Instance Attribute Details
#output ⇒ Interface (readonly)
Returns the actual output type to use.
15 16 17 |
# File 'lib/sober_swag/reporting/output/referenced.rb', line 15 def output @output end |
#reference ⇒ String (readonly)
Returns key in the components hash.
19 20 21 |
# File 'lib/sober_swag/reporting/output/referenced.rb', line 19 def reference @reference end |
Instance Method Details
#call(input) ⇒ Object
21 22 23 |
# File 'lib/sober_swag/reporting/output/referenced.rb', line 21 def call(input) output.call(input) end |
#ref_path ⇒ Object
29 30 31 |
# File 'lib/sober_swag/reporting/output/referenced.rb', line 29 def ref_path "#/components/schemas/#{reference}" end |
#serialize_report(input) ⇒ Object
25 26 27 |
# File 'lib/sober_swag/reporting/output/referenced.rb', line 25 def serialize_report(input) output.serialize_report(input) end |
#swagger_schema ⇒ Object
33 34 35 36 37 38 |
# File 'lib/sober_swag/reporting/output/referenced.rb', line 33 def swagger_schema [ { "$ref": ref_path }, { reference => proc { output.swagger_schema } } ] end |