class ParamsProcessor::ParamDoc

Public Instance Methods

combined() click to toggle source
# File lib/params_processor/param_doc.rb, line 28
def combined
  { all_of: all_of, one_of: one_of, any_of: any_of, not: not_be }.keep_if { |_k, v| !v.nil? }
end
combined?() click to toggle source
# File lib/params_processor/param_doc.rb, line 32
def combined?; combined.present? end
combined_modes() click to toggle source
# File lib/params_processor/param_doc.rb, line 34
def combined_modes; combined.keys end
doced_permit?() click to toggle source
# File lib/params_processor/param_doc.rb, line 38
def doced_permit?; permit? || not_permit? end
range() click to toggle source

Interfaces for directly taking the processed info what we focus on.

# File lib/params_processor/param_doc.rb, line 8
def range
  return if (schema.keys & %w[ minimum maximum ]).blank?
  {
      min: schema[:minimum] || -Float::INFINITY,
      max: schema[:maximum] || Float::INFINITY,
      should_neq_min?: schema[:exclusiveMinimum] || false,
      should_neq_max?: schema[:exclusiveMaximum] || false
  }
end
real_name() click to toggle source
# File lib/params_processor/param_doc.rb, line 36
def real_name; as || name end
size() click to toggle source
# File lib/params_processor/param_doc.rb, line 18
def size
  return if (schema.keys & %w[ minItems maxItems minLength maxLength ]).blank?
  size = if type.in? %w[ array object ]
           [schema[:minItems], schema[:maxItems]]
         else
           [schema[:minLength], schema[:maxLength]]
         end
  { min: size[0] || 0, max: size[1] || Float::INFINITY }
end