node-red-contrib-dynamic-request-validator
v1.1.8
Published
Create Schemas to validate request method, body and query parameters. Schemas are configured in this node Properties.
Downloads
67
Maintainers
Readme
Create Schemas to validate request method, body and query parameters. Schemas are configured in this node Properties.
Properties
Method (GET, POST, PUT, DELETE) - the expected method of the request to be validated.
Validation Schema/Rules - Schema to validate Rules.
Outputs
- Valid Request (top output)
msg (any)
- the original msg of request.
- Invalid Request (bottom output)
payload (json)
- the error message.statusCode (400 | 500)
- the status code of error.
Examples
Body schema example
* Sample JSON for validator
{"value":"provide dot string path of your values which need to validate","required":{"value":"value should be true / false","message":"specified return msg","errCode":"specified return error Code"},"regex":{"value":"provide regex","message":"specified return msg","errCode":"specified return error Code"},"minLength":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code"},"maxLength":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code"},"equal":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code","defaultValue":"Default Value to validate"},"notEqual":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code","defaultValue":"Default Value to validate"},"isBefore":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code","defaultValue":"Default Value to validate"},"greaterThan":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code","defaultValue":"Default Value to validate"},"lessThan":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code","defaultValue":"Default Value to validate"},"greaterThanEqual":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code","defaultValue":"Default Value to validate"},"lessThanEqual":{"value":"Value to validate","message":"specified return msg","errCode":"specified return error Code","defaultValue":"Default Value to validate"},"type":{"value":"email|mobile|uuid|number|alphanumeric|isAddress|isHexString|decimal","message":"specified return msg","errCode":"specified return error Code","option":{"force_decimal":"","decimal_digits":"","locale":""}}}
Updates
- Valid Request (top output)
1.1.2
- Now we can validate Crypto Address and hash using Ethers package
- also we can check value only if value is not blank
1.1.3
- Resolve Typo error
1.1.5
- Resolve Issue regex not check if provide Type value