deepkit-framework
deepkit-framework copied to clipboard
HttpQuery validator expression in first argument leaks to other parameters
test('query validator withing HttpQuery', async () => {
class Controller {
@http.GET('do')
async do(
a: HttpQuery<string & MinLength<8>>,
b: HttpQuery<string>,
) {
return { valid: true };
}
}
const httpKernel = createHttpKernel([Controller]);
expect((await httpKernel.request(HttpRequest.GET('/do').query('a=aaaaaaaa&b=bbbb'))).json).toMatchObject({
valid: true
});
});
this should work, but fails since b
parameter also gets the MinLength<8>
validator attached. Error:
message": "Validation error:
b(minLength): Min length is 8 caused by value "bbbb"