schema.ts (688B)
1 import { 2 array, 3 isoDate, 4 length, 5 literal, 6 picklist, 7 string, 8 tuple, 9 union, 10 } from 'valibot'; 11 12 import { DAY_PERIOD_JA } from 'common/constant'; 13 14 import type { Output, SafeParseResult } from 'valibot'; 15 16 export const InputSchema = array( 17 union([ 18 tuple( 19 [string([isoDate('1列目は "yyyy-mm-dd" 形式の日付です')])], 20 picklist(['', ...DAY_PERIOD_JA], '曜日時限を入力してください'), 21 '何かが間違っています', 22 [length(22, '横22列のデータを入力してください')], 23 ), 24 tuple([literal('')]), 25 ]), 26 ); 27 28 export type InputSchema = Output<typeof InputSchema>; 29 export type InputSchemaSafeParseResult = SafeParseResult<typeof InputSchema>;