bugraoz93 commented on PR #44043: URL: https://github.com/apache/airflow/pull/44043#issuecomment-2480661125
> Thanks a few suggestions I’ve made the adjustments in the methods and let FastAPI handle it as a `422`. I followed a similar approach to the changes you made in the other PR. > The following were added in #43934 . The changes broke dashboard endpoint probably due `str` changed to `datetime` . During resolving merge conflicts maybe OptionalDateTimeQuery could be used for `end_date` which hopefully resolves this PR's use case. > > ``` > DateTimeQuery = Annotated[datetime, AfterValidator(_safe_parse_datetime)] > OptionalDateTimeQuery = Annotated[Union[datetime, None], AfterValidator(_safe_parse_datetime_optional)] > ``` > > https://github.com/apache/airflow/pull/43934/files#diff-183a76763667e545ddd8c2aadf6858fdd7a80fecdd04b71e61eaa4ff344239cdR638-R639 I haven’t updated the annotation to `datetime` yet because, in `airflow/utils/timezone.py`, we’re parsing the date as a `pendulum` object to ensure consistent `timezone` handling, and it currently accepts a string. If we want to validate the `datetime` type directly in FastAPI and ensure it works with `pendulum` for proper timezone handling, we could introduce a new implementation using something like `pendulum.instance()`. However, I’m uncertain if adding that new capability is necessary. If it is, I am up for the change. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
