roykoand commented on code in PR #73243:
URL: https://github.com/apache/airflow/pull/73243#discussion_r4026554350
##########
ts-sdk/adr/0002-native-dag-interface.md:
##########
@@ -90,6 +92,24 @@ One statement per task, with each ref named, is the form to
write. Nesting the c
shorthand for a two-task chain, not the general shape: a Dag of twenty tasks
reads as twenty flat
statements, never as a twenty-deep expression.
+### Omitting the task id
+
+A native task defaults its id to the handler's function name, so a named
handler needs none:
+
+```ts
+const extract = dag.task(async function extract(): Promise<number> {
+ return 42;
+});
+// task id "extract"
+```
+
+The id comes from the handler's *source* name, resolved when the bundle is
packed and written into
+the registration — not from `handler.name` at runtime, which minification
renames (see
+Implementation Notes). A handler with no source name — a bare anonymous arrow
passed inline,
+`dag.task(async () => 42)` — has nothing to resolve and is a compile error
until given an explicit
+id. This default is for native Dags, where both ends of every name are
TypeScript; a mixed-language
+handler follow the same convention but should probably use the explicit form,
more information in ([ADR-0001](0001-mixed-lang-dag-interface.md)).
Review Comment:
```suggestion
handler follows the same convention but should probably use the explicit
form, more information in ([ADR-0001](0001-mixed-lang-dag-interface.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]