Sha256: 2ccb1aee044a68bd728fc4fbe4cd31863ae5f79dbe207fc702acfd730b7f2961

Contents?: true

Size: 553 Bytes

Versions: 6

Compression:

Stored size: 553 Bytes

Contents

require 'json-schema/attributes/format'

module JSON
  class Schema
    class DateTimeV4Format < FormatAttribute
      def self.validate(current_schema, data, fragments, processor, validator, options = {})
        return unless data.is_a?(String)
        DateTime.rfc3339(data)
      rescue ArgumentError
        error_message = "The property '#{build_fragment(fragments)}' must be a valid RFC3339 date/time string"
        validation_error(processor, error_message, fragments, current_schema, self, options[:record_errors])
      end
    end
  end
end

Version data entries

6 entries across 5 versions & 3 rubygems

Version Path
json-schema-ouidou-2.9.1 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-ouidou-2.9.0 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-3.0.0 lib/json-schema/attributes/formats/date_time_v4.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/bundler/gems/json-schema-2253a5ee6679/lib/json-schema/attributes/formats/date_time_v4.rb
mountapi-0.11.1 vendor/json-schema/lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-2.8.1 lib/json-schema/attributes/formats/date_time_v4.rb