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"
this should work, but fails since
bparameter also gets theMinLength<8>validator attached. Error: