@@ -229,7 +229,7 @@ def main():
229229 type = str ,
230230 nargs = "*" ,
231231 default = [],
232- help = "Directories to exclude from validation (default: none)" ,
232+ help = "Directories to exclude from pipeline validation (default: none)" ,
233233 )
234234 parser .add_argument (
235235 "--interface-files" ,
@@ -238,6 +238,13 @@ def main():
238238 default = ["assets/interface.json" ],
239239 help = "Path to interface.json files (default: assets/interface.json)" ,
240240 )
241+ parser .add_argument (
242+ "--task-dirs" ,
243+ type = str ,
244+ nargs = "*" ,
245+ default = [],
246+ help = "Directories containing task files to validate against interface_import.schema.json (default: none)" ,
247+ )
241248
242249 args = parser .parse_args ()
243250
@@ -326,6 +333,37 @@ def is_excluded(file_path):
326333 f"Warning: Interface file { interface_file } does not exist, skipping..."
327334 )
328335
336+ # 验证 task 文件
337+ if args .task_dirs :
338+ print ("\n Validating task files..." )
339+ task_schema_path = schema_dir / "interface_import.schema.json"
340+ if task_schema_path .exists ():
341+ task_schema = load_jsonc (task_schema_path )
342+ task_schema_uri = task_schema_path .as_uri ()
343+ schema_store [task_schema_uri ] = task_schema
344+
345+ task_validator = create_validator (task_schema , schema_store )
346+
347+ for task_dir in args .task_dirs :
348+ task_path = Path (task_dir )
349+ if not task_path .exists ():
350+ print (
351+ f"Warning: Task directory { task_dir } does not exist, skipping..."
352+ )
353+ continue
354+
355+ for file_path in task_path .rglob ("*.json" ):
356+ if not validate_file (file_path , task_validator ):
357+ all_valid = False
358+
359+ for file_path in task_path .rglob ("*.jsonc" ):
360+ if not validate_file (file_path , task_validator ):
361+ all_valid = False
362+ else :
363+ print (
364+ f"Warning: Task schema { task_schema_path } does not exist, skipping task validation..."
365+ )
366+
329367 if all_valid :
330368 print ("\n ✅ All validations passed!" )
331369 sys .exit (0 )
0 commit comments