Skip to content

Commit 2c14a00

Browse files
authored
Permit None value for datetime
As mentioned in #77, we should permit a None value for datetime property under certain circumstances.
1 parent 86f7303 commit 2c14a00

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stac_pydantic/item.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ class ItemProperties(StacCommonMetadata):
1616
https://github.com/radiantearth/stac-spec/blob/v1.0.0/item-spec/item-spec.md#properties-object
1717
"""
1818

19-
datetime: Union[dt, str] = Field(..., alias="datetime")
19+
datetime: Union[dt, str, None] = Field(..., alias="datetime")
2020

2121
@validator("datetime")
22-
def validate_datetime(cls, v: Union[dt, str], values: Dict[str, Any]) -> dt:
23-
if v == "null":
22+
def validate_datetime(cls, v: Union[dt, str, None], values: Dict[str, Any]) -> dt:
23+
if v in ("null", None):
2424
if not values["start_datetime"] and not values["end_datetime"]:
2525
raise ValueError(
2626
"start_datetime and end_datetime must be specified when datetime is null"

0 commit comments

Comments
 (0)