From ad47efbe26da5749e4319aab179cde1d165d9fb1 Mon Sep 17 00:00:00 2001 From: smohiudd Date: Fri, 9 Aug 2024 14:24:04 -0600 Subject: [PATCH 1/2] check for none enddate --- ingest_api/runtime/src/schema_helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ingest_api/runtime/src/schema_helpers.py b/ingest_api/runtime/src/schema_helpers.py index 35544ff4..3a3d83ac 100644 --- a/ingest_api/runtime/src/schema_helpers.py +++ b/ingest_api/runtime/src/schema_helpers.py @@ -41,10 +41,10 @@ def check_extent(cls, v): class TemporalExtent(BaseModel): startdate: datetime - enddate: datetime + 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 From f97338cf0874f72bcf98656fd3e973ee1bcc1cc9 Mon Sep 17 00:00:00 2001 From: smohiudd Date: Thu, 15 Aug 2024 13:12:13 -0600 Subject: [PATCH 2/2] optional startdate null --- ingest_api/runtime/src/schema_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingest_api/runtime/src/schema_helpers.py b/ingest_api/runtime/src/schema_helpers.py index 3a3d83ac..3db5bf6a 100644 --- a/ingest_api/runtime/src/schema_helpers.py +++ b/ingest_api/runtime/src/schema_helpers.py @@ -40,7 +40,7 @@ def check_extent(cls, v): class TemporalExtent(BaseModel): - startdate: datetime + startdate: Union[datetime, None] enddate: Union[datetime, None] @root_validator