From 41d8ab0b127b5ecd56dfe85a674f77b34c7e9d1e Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 20 May 2024 22:25:52 +0200 Subject: [PATCH] allow null datetime --- stac_pydantic/item.py | 2 +- tests/example_stac/datetimerange.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stac_pydantic/item.py b/stac_pydantic/item.py index 4b2d54a..4fc24d5 100644 --- a/stac_pydantic/item.py +++ b/stac_pydantic/item.py @@ -20,7 +20,7 @@ class ItemProperties(StacCommonMetadata): """ # Overide the datetime field to be required - datetime: Optional[UtcDatetime] + datetime: Optional[UtcDatetime] = Field(...) # Check https://docs.pydantic.dev/dev-v2/migration/#changes-to-config for more information. model_config = ConfigDict(extra="allow") diff --git a/tests/example_stac/datetimerange.json b/tests/example_stac/datetimerange.json index d453321..f2e9e96 100644 --- a/tests/example_stac/datetimerange.json +++ b/tests/example_stac/datetimerange.json @@ -37,7 +37,7 @@ ] }, "properties":{ - "datetime":"2018-01-01T13:21:30Z", + "datetime":null, "start_datetime":"2018-01-01T13:21:30Z", "end_datetime":"2018-01-01T13:31:30Z" },