From ce3ee703dfb4918fef8151c318895a921f42831f Mon Sep 17 00:00:00 2001 From: Riccardo Balbo Date: Wed, 16 Oct 2024 19:56:27 +0200 Subject: [PATCH] improve validation errors --- lib/validate.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/validate.js b/lib/validate.js index 570ec796..a6a48865 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -752,19 +752,19 @@ export const blinkSchema = object().shape({ apiKey: string() .matches(/^blink_[A-Za-z0-9]+$/, { message: 'must match pattern blink_A-Za-z0-9' }) .when(['apiKeyRecv'], ([apiKeyRecv], schema) => { - if (!apiKeyRecv) return schema.required('required if apiKeyRecv not set') + if (!apiKeyRecv) return schema.required('required if api key for receiving not set') return schema.test({ test: apiKey => apiKey !== apiKeyRecv, - message: 'apiKey cannot be the same as apiKeyRecv' + message: 'api key for sending cannot be the same as for receiving' }) }), apiKeyRecv: string() .matches(/^blink_[A-Za-z0-9]+$/, { message: 'must match pattern blink_A-Za-z0-9' }) .when(['apiKey'], ([apiKey], schema) => { - if (!apiKey) return schema.required('required if apiKey not set') + if (!apiKey) return schema.required('required if api key for sending not set') return schema.test({ test: apiKeyRecv => apiKeyRecv !== apiKey, - message: 'apiKeyRecv cannot be the same as apiKey' + message: 'api key for receiving cannot be the same as for sending' }) }), currency: string()