From 1d21109907b31b498539084276a360ed9dd0cfa8 Mon Sep 17 00:00:00 2001 From: Saadiq Mohiuddin <34844565+smohiudd@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:57:33 -0600 Subject: [PATCH] fix: check none enddate in temporal validator (#419) --- ingest_api/runtime/src/schema_helpers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ingest_api/runtime/src/schema_helpers.py b/ingest_api/runtime/src/schema_helpers.py index 35544ff4..3db5bf6a 100644 --- a/ingest_api/runtime/src/schema_helpers.py +++ b/ingest_api/runtime/src/schema_helpers.py @@ -40,11 +40,11 @@ def check_extent(cls, v): class TemporalExtent(BaseModel): - startdate: datetime - enddate: datetime + startdate: Union[datetime, None] + enddate: Union[datetime, None] @root_validator def check_dates(cls, v): - if v["startdate"] >= v["enddate"]: + if (v["enddate"] is not None) and (v["startdate"] >= v["enddate"]): raise ValueError("Invalid extent - startdate must be before enddate") return v