Skip to content

Commit

Permalink
fix: check none enddate in temporal validator (#419)
Browse files Browse the repository at this point in the history
  • Loading branch information
smohiudd authored Sep 27, 2024
1 parent 675268b commit 1d21109
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ingest_api/runtime/src/schema_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1d21109

Please sign in to comment.