Aiven-Open / karapace

Karapace - Your Apache Kafka® essentials in one tool
https://karapace.io
Apache License 2.0
450 stars 68 forks source link

refactor: consolidate schema version resolution and validation logic #885

Closed nosahama closed 3 months ago

nosahama commented 3 months ago

About this change - What it does

Add support for -1 also as the latest schema version.

We add a class object to manage the schema version logic and refactor parts of the code to use this new schema version manager object to resolve the version and also perform validation, allowing us to handle the -1 as latest schema and other related validations without duplicating logic.

It was also drawn to my attention that we have to be backwards compatible with python-3.8 and above, thus some type hints still use earlier syntax and some are using newer ones, i faced this errors during the CI tests, thus test type hints are backwards compatible from python-3.8.

References:

Why this way

We want to keep the version related logic simple and dry.