ashb commented on code in PR #44692:
URL: https://github.com/apache/airflow/pull/44692#discussion_r1871200450
##########
airflow/api_fastapi/execution_api/datamodels/taskinstance.py:
##########
@@ -135,3 +135,11 @@ class TaskInstance(BaseModel):
run_id: str
try_number: int
map_index: int | None = None
+
+
+class RTIFPayload(BaseModel):
+ """Schema for setting RTIF for a task instance."""
+
+ rendered_fields: dict[str, str]
+
+ model_config = ConfigDict(extra="forbid")
Review Comment:
So, we could remove the top level "rendered_fields" we need in the object,
I.e. have the payload go from:
```json
{ "rendered_fields": {"bash_command": "this is a 'rendered' command"}}
```
To simply
```json
{ "bash_command": "this is a 'rendered' command"}
```
by making use of the "[RootModel" concept in
pydantic](https://docs.pydantic.dev/latest/concepts/models/#rootmodel-and-custom-root-types)
-- something like
```suggestion
RTIFPayload = RootModel[Dict[str, str]]
"""Schema for setting RTIF for a task instance."""
```
--
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]