@zomet/service-validator
v0.2.33
Published
_Validation tools for Zomet apps by standards_
Downloads
1,287
Readme
Zomet service validator
Validation tools for Zomet apps by standards
Standards
How to use it?
- Install this package in your Zomet service
# npm
npm i @zomet/service-validator
# yarn
yarn add @zomet/service-validator
- Use helpers to validate method input and output params
import { validate, validateInput, validateOutput } from '@zomet/service-validator';
// This functions return args if they are valid
// and throw error if one of args is invalid
// validate input params
validate('dex_v1', 'getAllowance', 'input', args); // returns args
validateInput('dex_v1','getAllowance', args);
// validate output params
validate('dex_v1', 'getAllowance', 'output', result);
validateOutput('dex_v1', 'getAllowance', result);