-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: consolidate schema version resolution and validation logic #885
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- we add a simple decorator which allows arguments for the exceptions to catch and also for the exception to later reraise from the caught exception - this simplifies the code within the version manager when we deal with versions that could be integer strings
nosahama
force-pushed
the
nosahama/resolve-minus-1-as-latest-version
branch
3 times, most recently
from
May 29, 2024 13:46
d961ed1
to
59046e7
Compare
nosahama
changed the title
refactor: consolidate version resolution and validation logic
refactor: consolidate schema version resolution and validation logic
May 29, 2024
nosahama
force-pushed
the
nosahama/resolve-minus-1-as-latest-version
branch
from
May 29, 2024 13:51
59046e7
to
f83cd9d
Compare
- this will replace the previously added `SchemaVersionManager` - it will handle the resolution and validation of versions - easy work between numeric and string version tags, keeping only the numeric version internally
…oller - update the signature of `subject_version_get` - update the signature of `subject_version_delete_local` - update the signature of `subject_version_referencedby_get` - change the various references/dependencies to build the version class
- replace `ResolvedVersion` references with builtin `int` to mimic the initial intention and encapsulate the `str`/`int` version logic to the `Version` class.
nosahama
force-pushed
the
nosahama/resolve-minus-1-as-latest-version
branch
2 times, most recently
from
June 3, 2024 16:51
19b02ee
to
43d7ed0
Compare
nosahama
force-pushed
the
nosahama/resolve-minus-1-as-latest-version
branch
from
June 3, 2024 19:56
43d7ed0
to
cf1facb
Compare
- this comes with the factory provider `Versioner`
nosahama
force-pushed
the
nosahama/resolve-minus-1-as-latest-version
branch
from
June 4, 2024 16:38
5f66a4a
to
9c02e37
Compare
nosahama
commented
Jun 4, 2024
jjaakola-aiven
requested changes
Jun 5, 2024
eliax1996
reviewed
Jun 5, 2024
- we create the `Version` objects in the API controller using the `Versioner.V()` factory method, but we've moved this statement inline as an argument to the dependent functions. This prevents us from overriding the `version` path parameter.
jjaakola-aiven
approved these changes
Jun 5, 2024
This was referenced Jun 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 frompython-3.8
.References:
Why this way
We want to keep the version related logic simple and dry.