karapace icon indicating copy to clipboard operation
karapace copied to clipboard

De-couple JSONSchema and Protobuf implementations from Avro

Open aiven-anton opened this issue 1 year ago • 0 comments

The Protobuf and JSONSchema implementations currently have dependencies on Avro's SchemaCompatibilityResult. These implementations should be independent from each other. If we need a container to carry compatibility check results, we should define our own and not piggy-back on Avro's implementation.

  • https://github.com/aiven/karapace/blob/85d8cc73f538d8af11aad0d2bc8681258c4aa1f0/karapace/compatibility/jsonschema/checks.py#L5
  • https://github.com/aiven/karapace/blob/85d8cc73f538d8af11aad0d2bc8681258c4aa1f0/karapace/compatibility/protobuf/checks.py#L5

Other than best-practice, this also has implications on type-checking, since we pass in objects of the wrong type to the fields of Avro-specific entities. In this example, we pass in list[str] for incompatibilities, where a avro.compatibility.SchemaIncompatibilityType is expected.

  • https://github.com/aiven/karapace/blob/85d8cc73f538d8af11aad0d2bc8681258c4aa1f0/karapace/compatibility/protobuf/checks.py#LL27C1-L28C1

aiven-anton avatar May 31 '23 10:05 aiven-anton