AVRO-1938: Generate Parsing Canonical Forms of Schema#1167
AVRO-1938: Generate Parsing Canonical Forms of Schema#1167kojiromike merged 4 commits intoapache:masterfrom
Conversation
This PR adds support for generating Parsing Canonical Forms of Avro Schemas to the main `avro` package. The bulk of work was done by @kojiromike and @forsberg. This PR cleans up code where necessary, adds more test cases, and clarifies on transformations where not applicable in Python (ex. Transformation of integers with leading zeros) Closes: https://issues.apache.org/jira/browse/AVRO-1938
This commit ensures that `names` is an optional parameter in all subclass implementations of `to_canonical_json`. It also addresses minor formatting issues and review comments to previous commits.
|
@kojiromike Would you prefer adding fingerprinting support in a subsequent PR, or should it be tacked to this PR itself? I am almost ready with fingerprinting changes. If we would like to let this PR bake for a bit, I can add fingerprinting support to the same PR. Or we can pull this in, and I can raise a separate PR. Please let me know. |
|
Fingerprinting support is now done and ready to push. 👍 |
| @property | ||
| def canonical_properties(self): | ||
| props = self.props | ||
| return collections.OrderedDict( |
There was a problem hiding this comment.
Should we just use a dictionary here?
There was a problem hiding this comment.
While keys are inserted in the order specified by the canonical form, dictionary order is guaranteed only in Python 3.7 and above. So I believe we still need this to be OrderedDict.
If we were to stop supporting 3.6 someday, we could revert to using a dictionary; I believe it would work without any changes.
|
Please put "closes #700" in the pr description to automatically close that pr on merge. |
|
@kojiromike Addressed the latest review comments. PR is good to go. |
This PR adds support for generating Parsing Canonical Forms of Avro Schemas to the main
avropackage.The bulk of the work was done by @kojiromike and @forsberg. This PR cleans up code where necessary, adds more test cases, and clarifies on transformations wherever not applicable in Python (ex. Transformation of integers with leading zeros)
Closes: https://issues.apache.org/jira/browse/AVRO-1938
Closes: #700
Make sure you have checked all steps below.
Jira
Tests
Test cases in
test/test_schema.py::CanonicalFormTestCaseCommits
Documentation
Test cases act as stand-ins for the feature for now. Comprehensive documentation needs to be added later.