Class: SoberSwag::Reporting::Input::Referenced
- Defined in:
- lib/sober_swag/reporting/input/referenced.rb
Overview
An input that should be "referenced" in the final schema.
Instance Attribute Summary collapse
-
#reference ⇒ String
readonly
Key in the components hash.
-
#value ⇒ Interface
readonly
The actual input.
Instance Method Summary collapse
- #call(input) ⇒ Object
-
#initialize(value, reference) ⇒ Referenced
constructor
A new instance of Referenced.
- #ref_path ⇒ Object private
- #swagger_schema ⇒ Object
Methods included from Interface
#add_schema_key, #call!, #described, #enum, #format, #in_range, #list, #mapped, #modify_schema, #multiple_of, #optional, #or, #referenced, #swagger_path_schema, #swagger_query_schema, #|
Constructor Details
#initialize(value, reference) ⇒ Referenced
Returns a new instance of Referenced.
7 8 9 10 |
# File 'lib/sober_swag/reporting/input/referenced.rb', line 7 def initialize(value, reference) @value = value @reference = reference end |
Instance Attribute Details
#reference ⇒ String (readonly)
Returns key in the components hash.
17 18 19 |
# File 'lib/sober_swag/reporting/input/referenced.rb', line 17 def reference @reference end |
#value ⇒ Interface (readonly)
Returns the actual input.
14 15 16 |
# File 'lib/sober_swag/reporting/input/referenced.rb', line 14 def value @value end |
Instance Method Details
#call(input) ⇒ Object
19 20 21 |
# File 'lib/sober_swag/reporting/input/referenced.rb', line 19 def call(input) @value.call(input) end |
#ref_path ⇒ Object (private)
32 33 34 |
# File 'lib/sober_swag/reporting/input/referenced.rb', line 32 def ref_path "#/components/schemas/#{reference}" end |
#swagger_schema ⇒ Object
23 24 25 26 27 28 |
# File 'lib/sober_swag/reporting/input/referenced.rb', line 23 def swagger_schema [ { "$ref": ref_path }, { reference => proc { value.swagger_schema } } ] end |