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 11import { z } from "zod" ;
22
33export 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 ;
56
67export const metadataSchema = z
78 . record ( z . string ( ) )
@@ -19,18 +20,18 @@ export const metadataSchema = z
1920 }
2021
2122 for ( const key of keys ) {
22- if ( key . length > MAX_STRING_LENGTH ) {
23+ if ( key . length > MAX_KEY_LENGTH ) {
2324 ctx . addIssue ( {
2425 code : z . ZodIssueCode . custom ,
25- message : `Metadata key "${ key } " exceeds ${ MAX_STRING_LENGTH } characters.` ,
26+ message : `Metadata key "${ key } " exceeds ${ MAX_KEY_LENGTH } characters.` ,
2627 } ) ;
2728 }
2829
2930 const value = metadata [ key ] ;
30- if ( value . length > MAX_STRING_LENGTH ) {
31+ if ( value . length > MAX_VALUE_LENGTH ) {
3132 ctx . addIssue ( {
3233 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.` ,
3435 } ) ;
3536 }
3637 }
Original file line number Diff line number Diff line change @@ -24,7 +24,12 @@ import { OrganizationList as orgList } from '@common/orgs';
2424import { AppRoles } from '@common/roles' ;
2525import { EVENT_CACHED_DURATION } from '@common/config' ;
2626import { 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' ;
2833
2934export function capitalizeFirstLetter ( string : string ) {
3035 return string . charAt ( 0 ) . toUpperCase ( ) + string . slice ( 1 ) ;
@@ -348,8 +353,8 @@ export const ManageEventPage: React.FC = () => {
348353 </ Button >
349354 </ Group >
350355 < 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.
353358 </ Text >
354359
355360 { Object . entries ( form . values . metadata || { } ) . map ( ( [ key , value ] , index ) => {
You can’t perform that action at this time.
0 commit comments