2019-09-22 01:52:10 +03:00
|
|
|
const spt = require('./ServerPropTypes.js');
|
|
|
|
|
|
|
|
const type = {
|
|
|
|
segment_id: { type: 'array', of: 'int', comment: 'Сегмент(ы)' },
|
|
|
|
init_area: { type: 'num', min: 0.1, required: true, comment: 'Начальное отклонение площади объекта' },
|
|
|
|
search_order: { type: 'array', of: {
|
|
|
|
field: { type: 'enum', of2: [ 'area', 'radius', 'pubdate' ], required: true, comment: 'Поле' },
|
|
|
|
step: { type: 'num', required: true, comment: 'Шаг' },
|
|
|
|
iter: { type: 'int', required: true, comment: 'Число итераций' },
|
|
|
|
}, comment: 'Порядок перебора параметров' },
|
|
|
|
};
|
|
|
|
|
|
|
|
console.log(JSON.stringify(spt.check({ type: 'object', items: type }, spt.metaType, { return_error: true }), null, 2));
|
2019-09-22 02:14:18 +03:00
|
|
|
|
|
|
|
// Self-validate!
|
2019-09-22 13:59:51 +03:00
|
|
|
let r = {};
|
|
|
|
for (let i = 0; i < 1000; i++)
|
|
|
|
r = spt.check(spt.metaType, spt.metaType, { return_error: true });
|
2019-09-22 02:14:18 +03:00
|
|
|
console.log(JSON.stringify(spt.check(spt.metaType, spt.metaType, { return_error: true }), null, 2));
|