fixed custom validator for json fields
This commit is contained in:
parent
c5fd8c4dc5
commit
31540d4d4b
|
|
@ -15,6 +15,11 @@ const longitudeRange = (field, { min = -180, max = 180 } = {}) =>
|
|||
.isFloat({ min, max })
|
||||
.withMessage(`|${field}| must be a number between ${min} and ${max}`)
|
||||
|
||||
const json = (field) =>
|
||||
check(field)
|
||||
.isJSON()
|
||||
.withMessage(`|${field}| must be a valid JSON string`);
|
||||
|
||||
export {
|
||||
integer,
|
||||
integerRange,
|
||||
|
|
@ -22,5 +27,6 @@ export {
|
|||
varChar,
|
||||
bigInt,
|
||||
latitudeRange,
|
||||
longitudeRange
|
||||
longitudeRange,
|
||||
json
|
||||
}
|
||||
Loading…
Reference in New Issue