class RailsParamValidation::IntegerValidator
def initialize(schema, collection)
def initialize(schema, collection) super schema, collection end
def matches?(path, data)
def matches?(path, data) if data.is_a? Integer return MatchResult.new data end unless data.is_a? String return MatchResult.new(nil, path, "Expected an integer") end begin return MatchResult.new(Integer(data)) rescue ArgumentError return MatchResult.new(nil, path, "Expected an integer") end end
def to_openapi
def to_openapi { type: :integer } end