Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/oceanum/datamesh/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,16 @@ class TimeFilter(BaseModel):
description="Resampling method applied when reducing tempral resolution. Only valid with range type",
)

@field_validator("times")
@classmethod
def validate_times(cls, v, info):
if info.data.get("type") == TimeFilterType.range:
if len(v) != 2:
raise ValueError(
"For TimeFilters of type='range', times must contain exactly 2 values: [timestart, timeend] which must be of type Timestamp, Timedelta or None"
)
return v


class AggregateOps(str, Enum):
mean = "mean"
Expand Down