class SoberSwag::Reporting::Input::Format

Specify that something must match a particular format. Note: said format is just a string.

Attributes

format[R]

@return [String]

input[R]

@return [Interface]

Public Class Methods

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

Public Instance Methods

call(object) click to toggle source
# File lib/sober_swag/reporting/input/format.rb, line 21
def call(object)
  input.call(object)
end
swagger_schema() click to toggle source
# File lib/sober_swag/reporting/input/format.rb, line 25
def swagger_schema
  schema, found = input.swagger_schema

  merged =
    if schema.key?(:$ref)
      { allOf: [schema] }
    else
      schema
    end.merge(format: format)
  [merged, found]
end