import { DestructiveRouteMethod , RouteConfig , RouteConfigOptions , RouteMethod , RouteValidatorFullConfig , } from 'kibana/server' ; import { schema } from '@kbn/config-schema' ; type Config < Method extends DestructiveRouteMethod > = RouteConfig < unknown , unknown , unknown , Method > ; interface ConfigWithoutBodyOptions < P , Q , B , Method extends RouteMethod > extends RouteConfig < P , Q , B , Method > { validate : Omit < RouteValidatorFullConfig < P , Q , B > , 'body' > ; options ? : Omit < RouteConfigOptions < Method > , 'body' > ; } see https see https export const skipBodyValidation = < Method extends DestructiveRouteMethod > ( config ) : Config < Method > => { return { ... config , validate : { ... config . validate , body : schema . buffer ( ) , } , options : { ... ( config . options || { } ) , body : { parse : false , } as RouteConfigOptions < Method > [ 'body' ] , } , } ; } ;