Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation for number of datetimes in Temporal.interval #17

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
5 changes: 3 additions & 2 deletions src/edr_pydantic/extent.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from typing import Annotated
from typing import List
from typing import Optional
from typing import Union

from annotated_types import Len
from pydantic import AwareDatetime

from .base_model import EdrBaseModel
Expand All @@ -13,8 +15,7 @@ class Spatial(EdrBaseModel):


class Temporal(EdrBaseModel):
# TODO: Validate this list has two items (C.7. Temporal Object)
interval: List[List[AwareDatetime]]
interval: List[Annotated[List[AwareDatetime], Len(min_length=2, max_length=2)]]
mo-lukecarr marked this conversation as resolved.
Show resolved Hide resolved
# TODO: Validate this is a list of ISO 8601 single time, ISO 8601 time duration or ISO 8601 interval
values: List[str]
trs: str
Expand Down
Loading