You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rpc: strictSerialization(false) is ignored over HTTP #771
strictSerialization(false) is documented as "No validation is performed", and over WebSocket an argument of another type is accepted. Over RpcHttpClientAdapter the arguments are still converted to the declared types and the call fails with a validation error.
import{App}from'@deepkit/app';import{ApplicationServer,FrameworkModule}from'@deepkit/framework';import{rpc,RpcClient,RpcHttpClientAdapter}from'@deepkit/rpc';interfaceEvent{name: string;at: number;}
@rpc.controller('legacy')classLegacyController{
@rpc.action().strictSerialization(false)track(event: Event): string{return`${event.name}${typeofevent.at}${event.at}`;}}constapp=newApp({controllers: [LegacyController],imports: [newFrameworkModule({port: 8080,httpRpcBasePath: '/api'})]});awaitapp.get(ApplicationServer).start();// an older client, built when `at` was still a date stringtypeOldEvent={name: string;at: string};typeOldLegacyController={track(event: OldEvent): string};constlegacy=newRpcClient(newRpcHttpClientAdapter('http://127.0.0.1:8080/api')).controller<OldLegacyController>('legacy');console.log(awaitlegacy.track({name: 'login',at: '2026-01-01'}).catch((error: Error)=>error.message));// actual: 'Validation error:\nevent.at(type): Cannot convert 2026-01-01 to number'// should be: 'login string 2026-01-01' (as over WebSocket)
Activity