1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/lib/routes/client-api/metrics-schema.js
2017-08-04 11:24:58 +02:00

21 lines
614 B
JavaScript

'use strict';
const joi = require('joi');
const countSchema = joi.object().options({ stripUnknown: true }).keys({
yes: joi.number().required().min(0).default(0),
no: joi.number().required().min(0).default(0),
});
const clientMetricsSchema = joi.object().options({ stripUnknown: true }).keys({
appName: joi.string().required(),
instanceId: joi.string().required(),
bucket: joi.object().required().keys({
start: joi.date().required(),
stop: joi.date().required(),
toggles: joi.object().pattern(/.*/, countSchema),
}),
});
module.exports = { clientMetricsSchema };