We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometime async custom validation is return before async request completes.
niv.extend('existsS3', async ({ value, args }) => { let bucket = args[0]; let prefix = args[1]; let s3Client = new S3Client({ region: process.env.AWS_REGION, });
try { await s3Client.send( new HeadObjectCommand({ Bucket: bucket, Key: path.join(prefix, value), }) ); return true; } catch (error) { console.log('errrrr'); return false; }
});
const v = new niv.Validator(metadata, { tracks: 'required|array|between:1,100', 'tracks..title': 'required|string|maxLength:150', 'tracks..mediaUrl': required|string|wavFile|existsS3:${sourceBucket},${sourcePrefix}, }); const matched = await v.check();
required|string|wavFile|existsS3:${sourceBucket},${sourcePrefix}
matched returns true before existsS3 rule completes its execution .
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Sometime async custom validation is return before async request completes.
niv.extend('existsS3', async ({ value, args }) => {
let bucket = args[0];
let prefix = args[1];
let s3Client = new S3Client({
region: process.env.AWS_REGION,
});
});
const v = new niv.Validator(metadata, {
tracks: 'required|array|between:1,100',
'tracks..title': 'required|string|maxLength:150',
'tracks..mediaUrl':
required|string|wavFile|existsS3:${sourceBucket},${sourcePrefix}
,});
const matched = await v.check();
matched returns true before existsS3 rule completes its execution .
The text was updated successfully, but these errors were encountered: