diff --git a/airflow/api_connexion/openapi/v1.yaml b/airflow/api_connexion/openapi/v1.yaml index 04b72bb7ebc4c..da5db06b3a5ee 100644 --- a/airflow/api_connexion/openapi/v1.yaml +++ b/airflow/api_connexion/openapi/v1.yaml @@ -2176,6 +2176,7 @@ components: type: integer operator: type: string + nullable: true queued_when: type: string nullable: true diff --git a/tests/api_connexion/endpoints/test_task_instance_endpoint.py b/tests/api_connexion/endpoints/test_task_instance_endpoint.py index 0b35ee38bc6c0..b28330e48d0bb 100644 --- a/tests/api_connexion/endpoints/test_task_instance_endpoint.py +++ b/tests/api_connexion/endpoints/test_task_instance_endpoint.py @@ -135,6 +135,13 @@ def create_task_instances( class TestGetTaskInstance(TestTaskInstanceEndpoint): def test_should_respond_200(self, session): self.create_task_instances(session) + # Update ti and set operator to None to + # test that operator field is nullable. + # This prevents issue when users upgrade to 2.0+ + # from 1.10.x + # https://github.com/apache/airflow/issues/14421 + session.query(TaskInstance).update({TaskInstance.operator: None}, synchronize_session='fetch') + session.commit() response = self.client.get( "/api/v1/dags/example_python_operator/dagRuns/TEST_DAG_RUN_ID/taskInstances/print_the_context", environ_overrides={"REMOTE_USER": "test"}, @@ -148,7 +155,7 @@ def test_should_respond_200(self, session): "executor_config": "{}", "hostname": "", "max_tries": 0, - "operator": "PythonOperator", + "operator": None, "pid": 100, "pool": "default_pool", "pool_slots": 1,