Skip to content
Myr

fix(types): allow `string[] | File[]` for RPC form value (#3117)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by GitHub · parent 4c401fd · Browse files · 2 files+12 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−4 removed

  • tests:+9 added−3 removed
  • other:+3 added−1 removed

2 files+12 added−4 removed

modified:src/validator/validator.test.ts+9 added-3 removed
1 unmodified line
2import type { ZodSchema } from 'zod'3import { z } from 'zod'4import { Hono } from '../hono'5import { HTTPException } from '../http-exception'6import type { ErrorHandler, ExtractSchema, MiddlewareHandler, ValidationTargets } from '../types'6import type {7 ErrorHandler,8 ExtractSchema,9 FormValue,10 MiddlewareHandler,11 ValidationTargets,12} from '../types'13import type { StatusCode } from '../utils/http-status'14import type { Equal, Expect } from '../utils/types'15import type { ValidationFunction } from './validator'16import { validator } from './validator'
731 unmodified lines
748 '/posts/:id': {749 $put: {750 input: {751 form: {746 title: string | File752 title: FormValue | FormValue[]753 }754 } & {755 param: {756 id: string
37 unmodified lines
794 '/purge': {795 $purge: {796 input: {797 form: {792 tag: string | File798 tag: FormValue | FormValue[]799 }800 } & {801 query: {802 q: string | string[]
272 unmodified lines
modified:src/types.ts+3 added-1 removed
1925 unmodified lines
1926////// ValidationTargets /////1927////// /////1928////////////////////////////////////////19291930export type FormValue = string | File19311932export type ValidationTargets = {1933 json: any1932 form: Record<string, string | File>1934 form: Record<string, FormValue | FormValue[]>1935 query: Record<string, string | string[]>1936 param: Record<string, string> | Record<string, string | undefined>1937 header: Record<string, string>1938 cookie: Record<string, string>
70 unmodified lines