-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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)]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: add some test cases to confirm that validation fails when lists are provided with len(...) != 2
.
I appear to get an error in IntelliJ on the use of |
Thanks for this draft PR. You probably need to add this snippet to make Python 3.8 happy:
|
My impression (maybe wrong!) is that Or is there a specific preference to use this approach? Happy to do so if there is! |
Ah! Didn't know this :) I guess I don't mind either way too much. Maybe the version check is a bit more explicit, but yours is fine as well. Could you still add the test for a failing validation case? |
Got some time set aside this afternoon to wrap up this PR. I don't want to block the 0.6.0 release much longer! |
WIP, aims to address the existing
TODO
comment for validating temporal list lengths.