@@ -6,14 +6,16 @@ const { t } = i18n;
66
77const member = z . custom < Member > ( ) ;
88
9+ export const projectWorkspaceNameRegex =
10+ / ^ (? ! - ) [ a - z A - Z 0 - 9 - ] { 1 , 63 } (?< ! - ) (?: \. (? ! - ) [ a - z A - Z 0 - 9 - ] { 1 , 63 } (?< ! - ) ) * $ / ;
11+ export const managedControlPlaneNameRegex =
12+ / ^ (? ! - ) [ a - z 0 - 9 - ] { 1 , 63 } (?< ! - ) (?: \. (? ! - ) [ a - z 0 - 9 - ] { 1 , 63 } (?< ! - ) ) * $ / ;
13+
914export const validationSchemaProjectWorkspace = z . object ( {
1015 name : z
1116 . string ( )
1217 . min ( 1 , t ( 'validationErrors.required' ) )
13- . regex (
14- / ^ (? ! - ) [ a - z A - Z 0 - 9 - ] { 1 , 63 } (?< ! - ) (?: \. (? ! - ) [ a - z A - Z 0 - 9 - ] { 1 , 63 } (?< ! - ) ) * $ / ,
15- t ( 'validationErrors.properFormatting' ) ,
16- )
18+ . regex ( projectWorkspaceNameRegex , t ( 'validationErrors.properFormatting' ) )
1719 . max ( 25 , t ( 'validationErrors.max25chars' ) ) ,
1820 displayName : z . string ( ) . optional ( ) ,
1921 chargingTarget : z . string ( ) . optional ( ) ,
@@ -24,7 +26,7 @@ export const validationSchemaCreateManagedControlPlane = z.object({
2426 . string ( )
2527 . min ( 1 , t ( 'validationErrors.required' ) )
2628 . regex (
27- / ^ (? ! - ) [ a - z 0 - 9 - ] { 1 , 63 } (?< ! - ) (?: \. (? ! - ) [ a - z 0 - 9 - ] { 1 , 63 } (?< ! - ) ) * $ / ,
29+ managedControlPlaneNameRegex ,
2830 t ( 'validationErrors.properFormattingLowercase' ) ,
2931 )
3032 . max ( 25 , t ( 'validationErrors.max25chars' ) ) ,
0 commit comments