Skip to content

Commit 27243d8

Browse files
feat: enhance bulkRequest validation message
1 parent 9673f36 commit 27243d8

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

packages/sdk/src/utils/validators.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,20 @@ export const bulkRequestSchema = () =>
108108
dataset: addressSchema().oneOf([NULL_ADDRESS]).required(),
109109
datasetmaxprice: positiveIntegerStringSchema().oneOf(['0']).required(),
110110
params: stringSchema()
111-
.test((value) => {
112-
try {
113-
// eslint-disable-next-line @typescript-eslint/naming-convention
114-
const { bulk_cid } = JSON.parse(value);
115-
if (typeof bulk_cid === 'string') {
116-
return true;
117-
}
118-
} catch {}
119-
return false;
120-
})
111+
.test(
112+
'is-valid-bulk-params',
113+
'${path} should be a valid JSON string with bulk_cid field',
114+
(value) => {
115+
try {
116+
// eslint-disable-next-line @typescript-eslint/naming-convention
117+
const { bulk_cid } = JSON.parse(value);
118+
if (typeof bulk_cid === 'string') {
119+
return true;
120+
}
121+
} catch {}
122+
return false;
123+
}
124+
)
121125
.required(),
122126
requester: addressSchema().required(),
123127
beneficiary: addressSchema().required(),

0 commit comments

Comments
 (0)