guan404ming commented on code in PR #69400:
URL: https://github.com/apache/airflow/pull/69400#discussion_r3548356603
##########
ts-sdk/src/sdk/registry.ts:
##########
@@ -39,11 +42,15 @@ export class TaskRegistry {
*/
register<TReturn = unknown>(registration: TaskRegistration, handler:
TaskHandler<TReturn>): void {
const { dagId, taskId } = registration;
- if (!dagId || typeof dagId !== "string") {
- throw new Error("dagId must be a non-empty string");
+ if (typeof dagId !== "string" || !KEY_REGEX.test(dagId)) {
+ throw new Error(
+ "dagId must be made of alphanumeric characters, dashes, dots, and
underscores",
+ );
}
- if (!taskId || typeof taskId !== "string") {
- throw new Error("taskId must be a non-empty string");
+ if (typeof taskId !== "string" || !KEY_REGEX.test(taskId)) {
+ throw new Error(
+ "taskId must be made of alphanumeric characters, dashes, dots, and
underscores",
+ );
Review Comment:
Sure, great suggestion, thanks! Just updated.
--
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]