From 3dea5c856154356ee86058ca15194b63cfd31b73 Mon Sep 17 00:00:00 2001 From: Kawa Date: Tue, 31 Mar 2026 09:49:13 +0200 Subject: [PATCH] feat(07-01): extend FieldDef with validate/tooltipText and add 3 validate rules - Add validate?: { regex: RegExp; message: string } to FieldDef interface - Add tooltipText?: string to FieldDef interface (prep for Plan 07-02) - Add validate rule to azureblob.account: /^[a-z0-9]{3,24}$/ - Add validate rule to s3.region: /^[a-z][a-z0-9-]+[a-z0-9]$/ - Add validate rule to gcs.project_number: /^\d+$/ --- src/schemas/registry.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/schemas/registry.ts b/src/schemas/registry.ts index 14eedb9..a7d749a 100644 --- a/src/schemas/registry.ts +++ b/src/schemas/registry.ts @@ -14,6 +14,8 @@ export interface FieldDef { placeholder?: string; helpText?: string; options?: { value: string; label: string }[]; // for inputType: 'select' + validate?: { regex: RegExp; message: string }; + tooltipText?: string; } export const BACKEND_REGISTRY = { @@ -28,6 +30,10 @@ export const BACKEND_REGISTRY = { required: true, placeholder: 'mystorageaccount', helpText: 'The storage account name (not the full URL)', + validate: { + regex: /^[a-z0-9]{3,24}$/, + message: 'Must be 3–24 lowercase alphanumeric characters (no hyphens or uppercase)', + }, }, { key: 'key', @@ -76,6 +82,10 @@ export const BACKEND_REGISTRY = { inputType: 'text', required: true, placeholder: 'us-east-1', + validate: { + regex: /^[a-z][a-z0-9-]+[a-z0-9]$/, + message: 'Must be a valid AWS region format (e.g. us-east-1)', + }, }, ], }, @@ -166,6 +176,10 @@ export const BACKEND_REGISTRY = { required: true, placeholder: '123456789', helpText: 'Your GCP project number (not project ID)', + validate: { + regex: /^\d+$/, + message: 'Must contain digits only', + }, }, { key: 'service_account_credentials',