bugraoz93 commented on PR #48914: URL: https://github.com/apache/airflow/pull/48914#issuecomment-2800126988
>@aritra24 This part class ExtraLinksResponse(RootModel[dict[str, str | None] | None]): threws. > >TypeError: unsupported operand type(s) for |: 'type' and 'NoneType' This occurs because the syntax str | None is not supported in Python 3.9. This union operator (|) for type hints was introduced in Python 3.10. Although from future import annotations postpones the evaluation of type annotations, it doesn't enable the use of the | operator for type unions in earlier Python versions. Since we are calling the class in tests, it throws the error. > >We can exclude some models in Custom Formatter but that could cause some models to be missing and want to be used in aitflowctl. So we can also find out why this model is coming from RootModel and not from from airflow.api_fastapi.core_api.base import BaseModel 🤔 Because if it would use BaseModel, we won't get this problem at all. > >Edit: Found the answer: https://github.com/apache/airflow/pull/44277/files#r1856765103 Regarding the above problem. Maybe we should consider supporting 3.10 from the beginning of `airflowctl`. @potiuk @kaxil @jedcunningham What do you think? There is a reason why we aren't using BaseModel and are using RootModel in the ExtraLinks. So, we can bump into similar issues in the future. -- 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]
