@@ -291,34 +291,68 @@ type RouterResponse =
291291 | ALBResult ;
292292
293293/**
294- * Configuration for request validation
294+ * Configuration for request validation.
295+ * At least one of body, headers, path, or query must be provided.
295296 */
296- type RequestValidationConfig < T = unknown > = {
297- body ?: StandardSchemaV1 < unknown , T > ;
298- headers ?: StandardSchemaV1 < unknown , Record < string , string > > ;
299- path ?: StandardSchemaV1 < unknown , Record < string , string > > ;
300- query ?: StandardSchemaV1 < unknown , Record < string , string > > ;
301- } ;
297+ type RequestValidationConfig < T = unknown > =
298+ | {
299+ body : StandardSchemaV1 < unknown , T > ;
300+ headers ?: StandardSchemaV1 < unknown , Record < string , string > > ;
301+ path ?: StandardSchemaV1 < unknown , Record < string , string > > ;
302+ query ?: StandardSchemaV1 < unknown , Record < string , string > > ;
303+ }
304+ | {
305+ body ?: StandardSchemaV1 < unknown , T > ;
306+ headers : StandardSchemaV1 < unknown , Record < string , string > > ;
307+ path ?: StandardSchemaV1 < unknown , Record < string , string > > ;
308+ query ?: StandardSchemaV1 < unknown , Record < string , string > > ;
309+ }
310+ | {
311+ body ?: StandardSchemaV1 < unknown , T > ;
312+ headers ?: StandardSchemaV1 < unknown , Record < string , string > > ;
313+ path : StandardSchemaV1 < unknown , Record < string , string > > ;
314+ query ?: StandardSchemaV1 < unknown , Record < string , string > > ;
315+ }
316+ | {
317+ body ?: StandardSchemaV1 < unknown , T > ;
318+ headers ?: StandardSchemaV1 < unknown , Record < string , string > > ;
319+ path ?: StandardSchemaV1 < unknown , Record < string , string > > ;
320+ query : StandardSchemaV1 < unknown , Record < string , string > > ;
321+ } ;
302322
303323/**
304- * Configuration for response validation
324+ * Configuration for response validation.
325+ * At least one of body or headers must be provided.
305326 */
306- type ResponseValidationConfig < T extends HandlerResponse = HandlerResponse > = {
307- body ?: StandardSchemaV1 < HandlerResponse , T > ;
308- headers ?: StandardSchemaV1 < Record < string , string > , Record < string , string > > ;
309- } ;
327+ type ResponseValidationConfig < T extends HandlerResponse = HandlerResponse > =
328+ | {
329+ body : StandardSchemaV1 < HandlerResponse , T > ;
330+ headers ?: StandardSchemaV1 <
331+ Record < string , string > ,
332+ Record < string , string >
333+ > ;
334+ }
335+ | {
336+ body ?: StandardSchemaV1 < HandlerResponse , T > ;
337+ headers : StandardSchemaV1 < Record < string , string > , Record < string , string > > ;
338+ } ;
310339
311340/**
312341 * Validation configuration for request and response.
313- * At least one of req or res should be provided.
342+ * At least one of req or res must be provided.
314343 */
315344type ValidationConfig <
316345 TReqBody = unknown ,
317346 TResBody extends HandlerResponse = HandlerResponse ,
318- > = {
319- req ?: RequestValidationConfig < TReqBody > ;
320- res ?: ResponseValidationConfig < TResBody > ;
321- } ;
347+ > =
348+ | {
349+ req : RequestValidationConfig < TReqBody > ;
350+ res ?: ResponseValidationConfig < TResBody > ;
351+ }
352+ | {
353+ req ?: RequestValidationConfig < TReqBody > ;
354+ res : ResponseValidationConfig < TResBody > ;
355+ } ;
322356
323357/**
324358 * Validation error details
0 commit comments