From de71fb54e9fcff8a0a1b8cfa218a08b3eeebaed6 Mon Sep 17 00:00:00 2001 From: Andreas Kienle Date: Wed, 16 Jul 2025 16:58:03 +0200 Subject: [PATCH] Fix max length of MCPs --- public/locales/en.json | 2 +- src/lib/api/validations/schemas.ts | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index 1850be24..b281794d 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -268,7 +268,7 @@ "required": "This field is required!", "properFormatting": "Use A-Z, a-z, 0-9, hyphen (-), and period (.), but note that whitespace (spaces, tabs, etc.) is not allowed for proper compatibility.", "properFormattingLowercase": "Use lowercase a-z, 0-9, hyphen (-), and period (.), but note that whitespace (spaces, tabs, etc.) is not allowed for proper compatibility.", - "max25chars": "Max length is 25 characters.", + "maxChars": "Max length is {{maxLength}} characters.", "userExists": "User with this email already exists!", "atLeastOneUser": "You need to have at least one member assigned." }, diff --git a/src/lib/api/validations/schemas.ts b/src/lib/api/validations/schemas.ts index 6239731e..72d267bd 100644 --- a/src/lib/api/validations/schemas.ts +++ b/src/lib/api/validations/schemas.ts @@ -1,10 +1,7 @@ import { z } from 'zod'; import { Member } from '../types/shared/members.ts'; import i18n from '../../../../i18n.ts'; -import { - managedControlPlaneNameRegex, - projectWorkspaceNameRegex, -} from './regex.ts'; +import { managedControlPlaneNameRegex, projectWorkspaceNameRegex } from './regex.ts'; const { t } = i18n; @@ -15,7 +12,7 @@ export const validationSchemaProjectWorkspace = z.object({ .string() .min(1, t('validationErrors.required')) .regex(projectWorkspaceNameRegex, t('validationErrors.properFormatting')) - .max(25, t('validationErrors.max25chars')), + .max(25, t('validationErrors.maxChars', { maxLength: 25 })), displayName: z.string().optional(), chargingTarget: z.string().optional(), chargingTargetType: z.string().optional(), @@ -25,11 +22,8 @@ export const validationSchemaCreateManagedControlPlane = z.object({ name: z .string() .min(1, t('validationErrors.required')) - .regex( - managedControlPlaneNameRegex, - t('validationErrors.properFormattingLowercase'), - ) - .max(25, t('validationErrors.max25chars')), + .regex(managedControlPlaneNameRegex, t('validationErrors.properFormattingLowercase')) + .max(36, t('validationErrors.maxChars', { maxLength: 36 })), displayName: z.string().optional(), chargingTarget: z.string().optional(), chargingTargetType: z.string().optional(),