How to use the z-schema.formatsCache function in z-schema

To help you get started, we’ve selected a few z-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LiskHQ / lisk-sdk-examples / framework / src / modules / chain / helpers / z_schema.js View on Github external
const { ACTIVE_DELEGATES, MAX_VOTES_PER_ACCOUNT } = global.constants;
			return (
				Number.isInteger(value) && MAX_VOTES_PER_ACCOUNT <= ACTIVE_DELEGATES
			);
		},
	},
};

// Register the formats
Object.keys(liskFormats).forEach(formatName => {
	z_schema.registerFormat(formatName, liskFormats[formatName]);
});

// Assigned as custom attribute to be used later
// since z_schema.getRegisteredFormats() only returns keys not the methods
z_schema.formatsCache = liskFormats;

// Exports
module.exports = z_schema;
github LiskHQ / lisk-sdk-examples / framework / src / controller / validator / z_schema.js View on Github external
const ZSchema = require('z-schema');
const formats = require('./formats');

// Register the formats
Object.keys(formats).forEach(formatName => {
	ZSchema.registerFormat(formatName, formats[formatName]);
});
ZSchema.formatsCache = formats;

module.exports = ZSchema;
github LiskHQ / lisk-sdk / framework / src / modules / http_api / helpers / z_schema.js View on Github external
const { ACTIVE_DELEGATES, MAX_VOTES_PER_ACCOUNT } = global.constants;
			return (
				Number.isInteger(value) && MAX_VOTES_PER_ACCOUNT <= ACTIVE_DELEGATES
			);
		},
	},
};

// Register the formats
Object.keys(liskFormats).forEach(formatName => {
	z_schema.registerFormat(formatName, liskFormats[formatName]);
});

// Assigned as custom attribute to be used later
// since z_schema.getRegisteredFormats() only returns keys not the methods
z_schema.formatsCache = liskFormats;

// Exports
module.exports = z_schema;
github LiskHQ / lisk-sdk / framework / src / controller / validator / z_schema.js View on Github external
const ZSchema = require('z-schema');
const formats = require('./formats');

// Register the formats
Object.keys(formats).forEach(formatName => {
	ZSchema.registerFormat(formatName, formats[formatName]);
});
ZSchema.formatsCache = formats;

module.exports = ZSchema;