omkar-foss commented on code in PR #43875:
URL: https://github.com/apache/airflow/pull/43875#discussion_r1855891060


##########
airflow/api_fastapi/core_api/datamodels/dag_run.py:
##########
@@ -73,3 +76,37 @@ class DAGRunCollectionResponse(BaseModel):
 
     dag_runs: list[DAGRunResponse]
     total_entries: int
+
+
+class TriggerDAGRunPostBody(BaseModel):
+    """Trigger DAG Run Serializer for POST body."""
+
+    dag_run_id: str | None = None
+    data_interval_start: AwareDatetime | None = None
+    data_interval_end: AwareDatetime | None = None
+
+    conf: dict = Field(default_factory=dict)
+    note: str | None = None
+
+    model_config = {"extra": "forbid"}

Review Comment:
   I suppose it'll be great to keep this consistent across all APIs. Legacy API 
throws 400 bad request on extra properties passed, while since FastAPI and 
Pydantic ignore extra properties, new APIs don't throw an error yet.
   
   We could either forbid extra properties for all models or for none of them, 
so the users have a consistent view of the APIs. In new APIs, I suppose 
currently forbidding is being done only in `CreateAssetEventsBody` 
[here](https://github.com/apache/airflow/blob/208f07b9e290d0d2de645b2f69a4ff49c94af7ee/airflow/api_fastapi/core_api/datamodels/assets.py#L146).
   



-- 
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]

Reply via email to