Class: SoberSwag::Reporting::Input::Described
- Defined in:
- lib/sober_swag/reporting/input/described.rb
Overview
Node for things with descriptions. This describes the type, not the object key.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
Description of input.
-
#input ⇒ Interface
readonly
Base input.
Instance Method Summary collapse
- #call(value) ⇒ Object
-
#initialize(input, description) ⇒ Described
constructor
A new instance of Described.
- #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(input, description) ⇒ Described
Returns a new instance of Described.
8 9 10 11 |
# File 'lib/sober_swag/reporting/input/described.rb', line 8 def initialize(input, description) @input = input @description = description end |
Instance Attribute Details
#description ⇒ String (readonly)
Returns description of input.
19 20 21 |
# File 'lib/sober_swag/reporting/input/described.rb', line 19 def description @description end |
#input ⇒ Interface (readonly)
Returns base input.
15 16 17 |
# File 'lib/sober_swag/reporting/input/described.rb', line 15 def input @input end |
Instance Method Details
#call(value) ⇒ Object
21 22 23 |
# File 'lib/sober_swag/reporting/input/described.rb', line 21 def call(value) input.call(value) end |
#swagger_schema ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/sober_swag/reporting/input/described.rb', line 25 def swagger_schema val, other = input.swagger_schema merged = if val.key?(:$ref) { allOf: [val] } else val end.merge(description: description) [merged, other] end |