1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/routes/client-api/metrics-schema.js
2020-02-20 08:34:20 +01:00

37 lines
874 B
JavaScript

'use strict';
const joi = require('joi');
const countSchema = joi
.object()
.options({ stripUnknown: true })
.keys({
yes: joi
.number()
.min(0)
.default(0),
no: joi
.number()
.min(0)
.default(0),
variants: joi.object().pattern(joi.string(), joi.number().min(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 };