class OpenAPIRest::Validators::Format
Rest format validator
Public Class Methods
new(format, value)
click to toggle source
# File lib/openapi_rest/validators/format.rb, line 7 def initialize(format, value) @format = format @value = value end
Public Instance Methods
error(key)
click to toggle source
# File lib/openapi_rest/validators/format.rb, line 19 def error(key) { key => "not a #{@format}" } end
valid?()
click to toggle source
# File lib/openapi_rest/validators/format.rb, line 12 def valid? return @value.is_a?(Numeric) if @format == 'int64' || @format == 'int32' return !DateTimeHelper.in_utc(@value).nil? if @format == 'date-time' true end