class SoberSwag::Reporting::Output::Referenced

Referenced: An input that will be referred to via reference in the final schema.

Attributes

output[R]

@return [Interface] the actual output type to use

reference[R]

@return [String] key in the components hash

Public Class Methods

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

Public Instance Methods

call(input) click to toggle source
# File lib/sober_swag/reporting/output/referenced.rb, line 21
def call(input)
  output.call(input)
end
ref_path() click to toggle source
# File lib/sober_swag/reporting/output/referenced.rb, line 29
def ref_path
  "#/components/schemas/#{reference}"
end
serialize_report(input) click to toggle source
# File lib/sober_swag/reporting/output/referenced.rb, line 25
def serialize_report(input)
  output.serialize_report(input)
end
swagger_schema() click to toggle source
# File lib/sober_swag/reporting/output/referenced.rb, line 33
def swagger_schema
  [
    { "$ref": ref_path },
    { reference => proc { output.swagger_schema } }
  ]
end