Skip to content
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

Update schema_registry.py #879

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions karapace/schema_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def validate_version(version: Version) -> Version:
version_number = int(version)
if version_number > 0:
return version
if version_number == -1:
return "latest"
raise InvalidVersion(f"Invalid version {version_number}")
except ValueError as ex:
if version == "latest":
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ async def test_schema_delete_latest_version(registry_async_client: Client, trail
await assert_schema_versions(registry_async_client, trail, schema_id_2, [])

# Deleting the latest version, no schemas left
res = await registry_async_client.delete(f"subjects/{subject}/versions/latest")
res = await registry_async_client.delete(f"subjects/{subject}/versions/-1")
assert res.status_code == 200
assert res.json() == version_1

Expand Down
Loading