ttben opened a new issue, #28825:
URL: https://github.com/apache/airflow/issues/28825

   ### Apache Airflow version
   
   2.5.0
   
   ### What happened
   
   Specifying a `note`  in the payload (as mentioned [in the 
doc](https://airflow.apache.org/docs/apache-airflow/2.5.0/stable-rest-api-ref.html#operation/post_dag_run))
 when triggering a new dag run yield a 400 bad request
   
   
   (Git Version: .release:2.5.0+fa2bec042995004f45b914dd1d66b466ccced410)
   
   
   
   
   ### What you think should happen instead
   
   As far as I understand the documentation, I should be able to set a note for 
this dag run, and it is not the case.
   
   ### How to reproduce
   
   
   This is a local airflow, using default credentials and default setup when 
following [this 
guide](https://airflow.apache.org/docs/apache-airflow/stable/howto/docker-compose/index.html#)
   
   DAG: 
   
   <details>
   
   ```
   import airflow
   from airflow import DAG
   
   import logging
   
   from airflow.operators.python import PythonOperator
   from airflow.operators.dummy import DummyOperator
   
   from datetime import timedelta
   
   logger = logging.getLogger("airflow.task")
   
   default_args = {
       "owner": "airflow",
       "depends_on_past": False,
       "retries": 0,
       "retry_delay": timedelta(minutes=5),
   }
   
   def log_body(**context):
       logger.info(f"Body: {context['dag_run'].conf}")
   
   
   with DAG(
           "my-validator",
           default_args=default_args,
           schedule_interval=None,
           start_date=airflow.utils.dates.days_ago(0),
           catchup=False
   ) as dag:
       (
           PythonOperator(
               task_id="abcde",
               python_callable=log_body,
               provide_context=True
           )
           >> DummyOperator(
               task_id="todo"
           )
       )
   ```
   
   </details>
   
   
   Request:
   
   <details>
   
   ```
   curl --location --request POST 
'0.0.0.0:8080/api/v1/dags/my-validator/dagRuns' \
   --header 'Authorization: Basic YWlyZmxvdzphaXJmbG93' \
   --header 'Content-Type: application/json' \
   --data-raw '{
     "conf": {
         "key":"value"
     },
     "note": "test"
     }' 
   ```
   
   </details>
   
   Response: 
   
   <details>
   
   ```
   {
       "detail": "{'note': ['Unknown field.']}",
       "status": 400,
       "title": "Bad Request",
       "type": 
"https://airflow.apache.org/docs/apache-airflow/2.5.0/stable-rest-api-ref.html#section/Errors/BadRequest";
   }
   ```
   
   </details>
   
   
   
   Removing the `note` key, returns 200... with a null `note`!
   
   <details>
   
   ```
   {
       "conf": {
           "key": "value"
       },
       "dag_id": "my-validator",
       "dag_run_id": "manual__2023-01-10T10:45:26.102802+00:00",
       "data_interval_end": "2023-01-10T10:45:26.102802+00:00",
       "data_interval_start": "2023-01-10T10:45:26.102802+00:00",
       "end_date": null,
       "execution_date": "2023-01-10T10:45:26.102802+00:00",
       "external_trigger": true,
       "last_scheduling_decision": null,
       "logical_date": "2023-01-10T10:45:26.102802+00:00",
       "note": null,
       "run_type": "manual",
       "start_date": null,
       "state": "queued"
   }
   ```
   
   
   </details>
   
   ### Operating System
   
   Ubuntu 20.04.5 LTS
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   Everytime.
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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