class SoberSwag::Reporting::Input::Referenced

An input that should be “referenced” in the final schema.

Attributes

reference[R]

@return [String] key in the components hash

value[R]

@return [Interface] the actual input

Public Class Methods

new(value, reference) click to toggle source
# File lib/sober_swag/reporting/input/referenced.rb, line 7
def initialize(value, reference)
  @value = value
  @reference = reference
end

Public Instance Methods

call(input) click to toggle source
# File lib/sober_swag/reporting/input/referenced.rb, line 19
def call(input)
  @value.call(input)
end
swagger_schema() click to toggle source
# File lib/sober_swag/reporting/input/referenced.rb, line 23
def swagger_schema
  [
    { "$ref": ref_path },
    { reference => proc { value.swagger_schema } }
  ]
end

Private Instance Methods

ref_path() click to toggle source
# File lib/sober_swag/reporting/input/referenced.rb, line 32
def ref_path
  "#/components/schemas/#{reference}"
end