uranusjr commented on code in PR #74538:
URL: https://github.com/apache/airflow/pull/74538#discussion_r4344059698


##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/DagDef.kt:
##########
@@ -85,19 +85,24 @@ class DagDef(
    * mismatched value types are rejected on the call, so mistakes surface where
    * the Dag is defined.
    *
+   * `"queue"` is the one key Airflow's Dag has no setting for.
+   * It is the queue every task of the Dag runs on, unless the task sets its 
own `"queue"`, and it cannot be blank.
+   *
    * @param key Airflow Dag setting name.
    * @param value Value matching the key's schema type. Durations take
    *    [java.time.Duration], date-times [java.time.OffsetDateTime] or
    *    [java.time.Instant], string arrays any `Iterable` of `String`.
    * @return This Dag, for chaining.
-   * @throws IllegalArgumentException if the key is unknown or the value type
-   *    does not match.
+   * @throws IllegalArgumentException if the key is unknown, the value type
+   *    does not match, or `"queue"` is blank.
    */
   fun config(
     key: String,
     value: Any?,
   ): DagDef {
-    dagConfig[key] = checkConfigValue("Dag", SchemaFields.DAG, key, value)
+    val checked = checkConfigValue("Dag", SchemaFields.DAG, key, value)
+    require(key != "queue" || (checked as String).isNotBlank()) { "Dag config 
key 'queue' must not be blank" }

Review Comment:
   This same rule also appears in AirflowProcessor.kt. Put it on the field 
instead.
   
   Give the generated Field (via DslField in build.gradle.kts) a constraint 
flag or a validator, enforce it once in `checkConfigValue`, and have the 
processor call that same check. The next constrained field won’t need another 
`key == "..."` branch, and the two error messages can style in sync.



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