jason810496 commented on code in PR #77081:
URL: https://github.com/apache/airflow/pull/77081#discussion_r4583477631


##########
airflow-core/adr/lang-sdk/0016-mapped-tasks-across-lang-sdks.md:
##########
@@ -185,12 +185,20 @@ Every kind carries `name` and `value_schema`: the 
parameter's name, and the JSON
 annotation for a runtime that decodes into machine types. Declaration order is 
load-bearing — an SDK
 that binds by position, as Go does, has nothing else to go on.
 
+A `param` entry has a `default` key exactly when the stub parameter declares a 
default, and is
+required without one. `"default": null` is a default of `None`, or its 
equivalent in the runtime's
+language, not a missing default: a parameter that defaults to `None` is common 
in Python. So a
+writer emits `default` whenever the stub declares one, `null` included, a 
reader tells the two

Review Comment:
   To match the condition above: #70570 doesn't write a declared default that 
`partial()` or `expand()` overrides.
   
   ```suggestion
   writer emits `default` whenever the server may read it, `null` included, a 
reader tells the two
   ```



##########
airflow-core/adr/lang-sdk/0016-mapped-tasks-across-lang-sdks.md:
##########
@@ -185,12 +185,20 @@ Every kind carries `name` and `value_schema`: the 
parameter's name, and the JSON
 annotation for a runtime that decodes into machine types. Declaration order is 
load-bearing — an SDK
 that binds by position, as Go does, has nothing else to go on.
 
+A `param` entry has a `default` key exactly when the stub parameter declares a 
default, and is
+required without one. `"default": null` is a default of `None`, or its 
equivalent in the runtime's

Review Comment:
   #70570 leaves `default` out when `partial()` or `expand()` sets the 
parameter (`use_default` in `build_mapped_arg_bindings`), since the server 
never falls back to it there. A non-JSON default that is never used then 
doesn't fail parsing (`test_non_json_unused_default_allowed`). In #77080 the 
default comes from `{$: expand, default: v}` in YAML, not from a stub signature.
   
   I dropped "and is required without one" because the next paragraph already 
says a parameter still unbound fails the task.
   
   ```suggestion
   A `param` entry has a `default` key exactly when the Dag author gives the 
parameter a default and
   the call does not set it through `partial()` or `expand()`. `"default": 
null` is a default of `None`,
   or its equivalent in the runtime's
   ```



##########
airflow-core/adr/lang-sdk/0016-mapped-tasks-across-lang-sdks.md:
##########
@@ -185,12 +185,20 @@ Every kind carries `name` and `value_schema`: the 
parameter's name, and the JSON
 annotation for a runtime that decodes into machine types. Declaration order is 
load-bearing — an SDK
 that binds by position, as Go does, has nothing else to go on.
 
+A `param` entry has a `default` key exactly when the stub parameter declares a 
default, and is
+required without one. `"default": null` is a default of `None`, or its 
equivalent in the runtime's
+language, not a missing default: a parameter that defaults to `None` is common 
in Python. So a
+writer emits `default` whenever the stub declares one, `null` included, a 
reader tells the two
+cases apart by the key and not by its value, and anything that reads and 
rewrites an entry keeps
+the key's presence.

Review Comment:
   #77080 relies on this: on a `run:` task only `{$: expand, default: v}` fills 
the entry, and the handler's own default doesn't apply. Saying so here keeps an 
SDK from expecting a TypeScript handler default to kick in.
   
   ```suggestion
   the key's presence. A default in the task handler's own code does not count.
   ```



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