pierrejeambrun commented on code in PR #44306:
URL: https://github.com/apache/airflow/pull/44306#discussion_r1863704399
##########
airflow/api_fastapi/core_api/datamodels/plugins.py:
##########
@@ -75,6 +75,9 @@ class PluginResponse(BaseModel):
ti_deps: list[Annotated[str, BeforeValidator(coerce_to_string)]]
listeners: list[str]
timetables: list[str]
+ priority_weight_strategies: list[Any]
+ admin_views: list[Any]
+ menu_links: list[Any]
Review Comment:
This new fields shouldn't be returned by the API, they are not needed at the
moment.
##########
airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -91,6 +92,13 @@ def file_token(self) -> str:
serializer = URLSafeSerializer(conf.get_mandatory_value("webserver",
"secret_key"))
return serializer.dumps(self.fileloc)
+ @model_validator(mode="before")
+ @classmethod
+ def remove_file_token(cls, data):
Review Comment:
There must be a cleaner way to achieve that. What exactly are we trying to
do ? I removed that model_validator and all tests remain green. Is that
necessary ?
##########
airflow/api_fastapi/core_api/datamodels/plugins.py:
##########
@@ -75,6 +75,9 @@ class PluginResponse(BaseModel):
ti_deps: list[Annotated[str, BeforeValidator(coerce_to_string)]]
listeners: list[str]
timetables: list[str]
+ priority_weight_strategies: list[Any]
+ admin_views: list[Any]
+ menu_links: list[Any]
Review Comment:
Yes I think Generic inside Generic are not well supported `T[K[V]]`
##########
airflow/api_fastapi/core_api/datamodels/dags.py:
##########
@@ -91,6 +92,13 @@ def file_token(self) -> str:
serializer = URLSafeSerializer(conf.get_mandatory_value("webserver",
"secret_key"))
return serializer.dumps(self.fileloc)
+ @model_validator(mode="before")
+ @classmethod
+ def remove_file_token(cls, data):
Review Comment:
I just pushed a commit that should look better, you tell me.
##########
airflow/api_fastapi/core_api/datamodels/plugins.py:
##########
@@ -75,6 +75,9 @@ class PluginResponse(BaseModel):
ti_deps: list[Annotated[str, BeforeValidator(coerce_to_string)]]
listeners: list[str]
timetables: list[str]
+ priority_weight_strategies: list[Any]
+ admin_views: list[Any]
+ menu_links: list[Any]
Review Comment:
Be can either pop them manually before using the model (not great because we
would need to extend that to every endpoint constructing a XXXXResponse object
that has a richer dict as a source), or allow extra for `XXXXResponse` and only
apply it to `XXXXBody`
--
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]