Class: Avro::SchemaValidator
- Inherits:
-
Object
- Object
- Avro::SchemaValidator
- Defined in:
- lib/avro-patches/schema_validator/schema_validator.rb
Defined Under Namespace
Classes: Result, ValidationError
Constant Summary collapse
- ROOT_IDENTIFIER =
'.'.freeze
- PATH_SEPARATOR =
'.'.freeze
- INT_RANGE =
Schema::INT_MIN_VALUE..Schema::INT_MAX_VALUE
- LONG_RANGE =
Schema::LONG_MIN_VALUE..Schema::LONG_MAX_VALUE
- COMPLEX_TYPES =
[:array, :error, :map, :record, :request].freeze
- BOOLEAN_VALUES =
[true, false].freeze
- TypeMismatchError =
Class.new(ValidationError)
Class Method Summary collapse
-
.validate!(expected_schema, datum, options = { recursive: true }) ⇒ Object
This method is replaced by code in AvroPatches::LogicalTypes::SchemaValidatorPatch.
Class Method Details
.validate!(expected_schema, datum, options = { recursive: true }) ⇒ Object
This method is replaced by code in AvroPatches::LogicalTypes::SchemaValidatorPatch.
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/avro-patches/schema_validator/schema_validator.rb', line 67 def validate!(expected_schema, datum, = { recursive: true }) ||= {} [:recursive] = true unless .key?(:recursive) result = Avro::SchemaValidator::Result.new if [:recursive] validate_recursive(expected_schema, datum, ROOT_IDENTIFIER, result) else validate_simple(expected_schema, datum, ROOT_IDENTIFIER, result) end fail Avro::SchemaValidator::ValidationError, result if result.failure? result end |