GitHub user tjwp opened a pull request:
https://github.com/apache/avro/pull/170
Add schema compatibility checker for Ruby
This change introduces a module `Avro::SchemaCompatibility` to perform a
full compatibility check between two schemas in Ruby. This compatibility check
extends the existing schema matching implemented in
`Avro::IO::DatumReader.match_schemas`. The implementation of the
`.match_schemas` class method has been moved to the new module and is called as
part of the full compatibility check.
`#read?`, `#be_read?` and `#mutual_read?` methods have been added to
`Avro::Schema` as a way to invoke the new compatibility checks. A `#default?`
method has been added to `Field` to determine if a field has a default.
Tests for the new module were based on the test cases from:
-
lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator2.java
- lang/java/avro/src/test/java/org/apache/avro/TestSchemaCompatibility.java
Additional fixes included:
- support for empty records and empty unions in Ruby (these were useful to
demonstrate test parity for compatibility checking)
- schema promotion between bytes and strings in `.match_schemas`
- schema promotion within complex types in `.match_schemas`, e.g. an array
of ints promoted to an array of longs
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/salsify/avro compatibility_validator
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/avro/pull/170.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #170
----
commit c404846078507405220f4862e72ccca034bfcfd4
Author: Tim Perkins <[email protected]>
Date: 2016-12-15T14:35:21Z
Add schema compatibility checker for Ruby
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---