File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed
components/zod/custom-types Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -7,4 +7,4 @@ export * from './json-string';
77export * from './entity-name' ;
88export * from './tenant-settings' ;
99export * from './primitive' ;
10- export * from './query- string-array' ;
10+ export * from './string-array' ;
Original file line number Diff line number Diff line change 11import { z } from 'zod' ;
22
3- export const queryStringArray = ( ) => {
3+ export const stringArray = ( { min = 0 , max = Infinity } : { min ?: number ; max ?: number } ) => {
44 return z
55 . union ( [ z . string ( ) , z . array ( z . string ( ) ) ] )
6- . transform ( ( val ) => ( typeof val === 'string' ? [ val ] : val ) ) ;
6+ . transform ( ( val ) => ( typeof val === 'string' ? [ val ] : val ) )
7+ . pipe ( z . array ( z . string ( ) ) . min ( min ) . max ( max ) ) ;
78} ;
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ const requestSchema = {
1313 query : z . object ( {
1414 lockToken : z . string ( ) . optional ( ) ,
1515 scope : z . nativeEnum ( EntryScope ) . optional ( ) ,
16- types : zc . queryStringArray ( ) . optional ( ) ,
16+ types : zc . stringArray ( { min : 0 , max : 100 } ) . optional ( ) ,
1717 } ) ,
1818} ;
1919
You can’t perform that action at this time.
0 commit comments