api: Don't do version check if nothing required

There's no reason to inspect the API version requested (and reject
things if unset) if we don't have version constraints on the API
resource. This lets us add schema decorators to unversioned API
resources (i.e. the "versions" API at '/').

Change-Id: Ib4d4585e3e4664eba8cd3daa47b4349eb2bfed74
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2024-03-26 21:36:55 +00:00
parent b1824c5c97
commit ff040ada4f
+2 -2
View File
@@ -389,10 +389,10 @@ class APIVersionRequest(object):
If self is null then raise ValueError
"""
if self.is_null():
raise ValueError
if max_version.is_null() and min_version.is_null():
return True
elif self.is_null():
raise ValueError
elif max_version.is_null():
return min_version <= self
elif min_version.is_null():