lib/avro/schema.rb in avro-1.10.1 vs lib/avro/schema.rb in avro-1.10.2
- old
+ new
@@ -34,10 +34,12 @@
INT_MIN_VALUE = -(1 << 31)
INT_MAX_VALUE = (1 << 31) - 1
LONG_MIN_VALUE = -(1 << 63)
LONG_MAX_VALUE = (1 << 63) - 1
+ DEFAULT_VALIDATE_OPTIONS = { recursive: true, encoded: false }.freeze
+
def self.parse(json_string)
real_parse(MultiJson.load(json_string), {})
end
# Build Avro Schema from data parsed out of JSON string.
@@ -107,10 +109,10 @@
raise UnknownSchemaError.new(json_obj)
end
end
# Determine if a ruby datum is an instance of a schema
- def self.validate(expected_schema, logical_datum, options = { recursive: true, encoded: false })
+ def self.validate(expected_schema, logical_datum, options = DEFAULT_VALIDATE_OPTIONS)
SchemaValidator.validate!(expected_schema, logical_datum, options)
true
rescue SchemaValidator::ValidationError
false
end