diff --git a/projects/composition/src/app/api-data/cron-validation.service.json b/projects/composition/src/app/api-data/cron-validation.service.json new file mode 100644 index 00000000..28b4e9af --- /dev/null +++ b/projects/composition/src/app/api-data/cron-validation.service.json @@ -0,0 +1,28 @@ +{ + "components": {}, + "name": "CronValidationService", + "description": "Service for validating 6-field cron expressions with extended features.\n\nThis service handles cron validation logic for extended cron expression formats\nthat support additional features beyond standard Unix cron for more flexible\nscheduling capabilities.\n\nFormat: minutes hours day-of-month month day-of-week year\n\nKey Features:\n- Wildcards: asterisk (any value), question mark (any value for day fields)\n- Ranges: 1-5, MON-FRI, JAN-MAR\n- Steps: asterisk/15, 5/10, 1-5/2\n- Lists: 1,3,5, MON,WED,FRI\n- Special chars: L (last), W (weekday), hash (nth occurrence)", + "methods": { + "description": "Methods used in service.", + "values": [ + { + "name": "isValidCron", + "parameters": [ + { + "name": "cron", + "type": "string", + "description": "The 6-field cron expression to validate" + }, + { + "name": "allowEmpty", + "type": "boolean", + "description": "Whether to allow empty cron expressions", + "defaultValue": "false" + } + ], + "returnType": "boolean", + "description": "Validates a complete 6-field cron expression." + } + ] + } +} \ No newline at end of file diff --git a/projects/cps-ui-kit/src/lib/services/cron-validation.service.ts b/projects/cps-ui-kit/src/lib/services/cron-validation.service.ts index f22f1fe6..11c657dd 100644 --- a/projects/cps-ui-kit/src/lib/services/cron-validation.service.ts +++ b/projects/cps-ui-kit/src/lib/services/cron-validation.service.ts @@ -16,6 +16,7 @@ import { Injectable } from '@angular/core'; * - Lists: 1,3,5, MON,WED,FRI * - Special chars: L (last), W (weekday), hash (nth occurrence) * @see {@link https://docs.aws.amazon.com/scheduler/latest/UserGuide/schedule-types.html#cron-based | AWS EventBridge Scheduler - Cron-based schedules} + * @group Services */ @Injectable({ providedIn: 'root' @@ -27,6 +28,7 @@ export class CronValidationService { * @param cron - The 6-field cron expression to validate * @param allowEmpty - Whether to allow empty cron expressions * @returns boolean - True if the cron expression is valid + * @group Method */ isValidCron(cron: string, allowEmpty = false): boolean { if (typeof cron !== 'string') return false;