Trigger a DAG Run via the Stable REST API fails with Bad Request due to external_trigger is set
See original GitHub issueApache Airflow version:
2.0.0
Environment:
- Cloud provider or hardware configuration: OpenStack -> VM -> Docker container
- OS (e.g. from /etc/os-release): Debian GNU/Linux 10 (buster)
- Kernel (e.g.
uname -a
): Linux 77f8efd77516 4.4.0-193-generic #224-Ubuntu
What happened:
I am trying to trigger a DAG run via the new stable REST-API 1.0.0
by using a Java-based client. The Java client is generated from the Airflow OpenAPI specification with OpenAPI generator version 5.0.0
.
In Airflow I have one active DAG demo
I trigger the DAG execution via the java client with the following code snippet:
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://1.2.3.4:8080/api/v1);
DagRunApi dagRunApi = new DagRunApi(defaultClient);
DAGRun dagRun = new DAGRun();
try {
DAGRun result = dagRunApi.postDagRun("demo", dagRun);
LOGGER.debug(result);
} catch (ApiException e) {
e.printStackTrace();
}
However, I receive the following exception:
BAD REQUEST
What you expected to happen:
By checking the airflow logs it turned out that the external_trigger
value of the DAGRun
is set but this is actually a read-only value and not allowed to be set which results in the BAD REQUEST
response.
Adding the nullable: true
setting to the external_trigger
and recreating the java client resolved the issue!
external_trigger:
type: boolean
nullable: true
readOnly: true
How to reproduce it:
Create the Java client (probably any client will produce this error) via OpenAPI generator:
java -jar codegen/openapi-generator-cli-5.0.0.jar generate -i openapi.yaml -g java -o .
- create a simple java class and apply the code snippets from above
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
https://github.com/OpenAPITools/openapi-generator/issues/4190 It looks related.
@houqp Can you check it?