Sha256: 98d5d95f42ee06e025a15aa6814a1d312512b8a8ae4477a7ebb1adb80c556117

Contents?: true

Size: 545 Bytes

Versions: 10

Compression:

Stored size: 545 Bytes

Contents

require 'json-schema/attribute'

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

10 entries across 10 versions & 2 rubygems

Version Path
json-schema-2.8.0 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-2.7.0 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-2.6.2 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-2.6.1 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-2.6.0 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-2.5.2 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-openc-fork-0.0.2 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-2.5.1 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-openc-fork-0.0.1 lib/json-schema/attributes/formats/date_time_v4.rb
json-schema-2.5.0 lib/json-schema/attributes/formats/date_time_v4.rb