SamWheating opened a new issue, #30075: URL: https://github.com/apache/airflow/issues/30075
### Apache Airflow version main (development) ### What happened While working on another change I noticed that the example [POST from the API docs](https://airflow.apache.org/docs/apache-airflow/stable/stable-rest-api-ref.html#operation/post_dag_run) actually leads to a request Error: ``` curl -X POST -H "Cookie: session=xxxx" localhost:8080/api/v1/dags/data_warehouse_dag_5by1a2rogu/dagRuns -d '{"dag_run_id":"string2","logical_date":"2019-08-24T14:15:24Z","execution_date":"2019-08-24T14:15:24Z","conf":{},"state":"queued","note":"strings"}' -H 'Content-Type: application/json' { "detail": "Property is read-only - 'state'", "status": 400, "title": "Bad Request", "type": "http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow/latest/stable-rest-api-ref.html#section/Errors/BadRequest" } ``` I believe that this comes from the DagRunSchema marking this field as dump_only: https://github.com/apache/airflow/blob/478fd826522b6192af6b86105cfa0686583e34c2/airflow/api_connexion/schemas/dag_run_schema.py#L69 So either - 1) The documentation / API spec is incorrect and this field cannot be set in the request 2) The marshmallow schema is incorrect and this field is incorrectly marked as `dump_only` I think that its the former, as there's [even a test to ensure that this field can't be set in a request](https://github.com/apache/airflow/blob/751a995df55419068f11ebabe483dba3302916ed/tests/api_connexion/endpoints/test_dag_run_endpoint.py#L1247-L1257) - I can look into this and fix it soon. ### What you think should happen instead The API should accept requested which follow examples from the documentation. ### How to reproduce Spin up breeze and POST a create dagrun request which attempts to set the DagRun state. ### Operating System Breeze ### Versions of Apache Airflow Providers _No response_ ### Deployment Other ### Deployment details _No response_ ### Anything else _No response_ ### Are you willing to submit PR? - [X] 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]
