diff --git a/karapace/schema_registry.py b/karapace/schema_registry.py index aa6f1dabc..eb8ae124b 100644 --- a/karapace/schema_registry.py +++ b/karapace/schema_registry.py @@ -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": diff --git a/tests/integration/test_schema.py b/tests/integration/test_schema.py index fa8d0ddae..e98e0d2f0 100644 --- a/tests/integration/test_schema.py +++ b/tests/integration/test_schema.py @@ -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