File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { z } from "zod" ;
2
2
3
3
export const MAX_METADATA_KEYS = 10 ;
4
- export const MAX_STRING_LENGTH = 100 ;
4
+ export const MAX_KEY_LENGTH = 50 ;
5
+ export const MAX_VALUE_LENGTH = 1000 ;
5
6
6
7
export const metadataSchema = z
7
8
. record ( z . string ( ) )
@@ -19,18 +20,18 @@ export const metadataSchema = z
19
20
}
20
21
21
22
for ( const key of keys ) {
22
- if ( key . length > MAX_STRING_LENGTH ) {
23
+ if ( key . length > MAX_KEY_LENGTH ) {
23
24
ctx . addIssue ( {
24
25
code : z . ZodIssueCode . custom ,
25
- message : `Metadata key "${ key } " exceeds ${ MAX_STRING_LENGTH } characters.` ,
26
+ message : `Metadata key "${ key } " exceeds ${ MAX_KEY_LENGTH } characters.` ,
26
27
} ) ;
27
28
}
28
29
29
30
const value = metadata [ key ] ;
30
- if ( value . length > MAX_STRING_LENGTH ) {
31
+ if ( value . length > MAX_VALUE_LENGTH ) {
31
32
ctx . addIssue ( {
32
33
code : z . ZodIssueCode . custom ,
33
- message : `Metadata value for key "${ key } " exceeds ${ MAX_STRING_LENGTH } characters.` ,
34
+ message : `Metadata value for key "${ key } " exceeds ${ MAX_VALUE_LENGTH } characters.` ,
34
35
} ) ;
35
36
}
36
37
}
Original file line number Diff line number Diff line change @@ -24,7 +24,12 @@ import { OrganizationList as orgList } from '@common/orgs';
24
24
import { AppRoles } from '@common/roles' ;
25
25
import { EVENT_CACHED_DURATION } from '@common/config' ;
26
26
import { IconPlus , IconTrash } from '@tabler/icons-react' ;
27
- import { MAX_METADATA_KEYS , MAX_STRING_LENGTH , metadataSchema } from '@common/types/events' ;
27
+ import {
28
+ MAX_METADATA_KEYS ,
29
+ MAX_KEY_LENGTH ,
30
+ MAX_VALUE_LENGTH ,
31
+ metadataSchema ,
32
+ } from '@common/types/events' ;
28
33
29
34
export function capitalizeFirstLetter ( string : string ) {
30
35
return string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 ) ;
@@ -348,8 +353,8 @@ export const ManageEventPage: React.FC = () => {
348
353
</ Button >
349
354
</ Group >
350
355
< Text size = "xs" c = "dimmed" >
351
- These values can be acceessed via the API. Max { MAX_STRING_LENGTH } characters for keys
352
- and values.
356
+ These values can be acceessed via the API. Max { MAX_KEY_LENGTH } characters for keys
357
+ and { MAX_VALUE_LENGTH } chars for values.
353
358
</ Text >
354
359
355
360
{ Object . entries ( form . values . metadata || { } ) . map ( ( [ key , value ] , index ) => {
You can’t perform that action at this time.
0 commit comments