/
proxy-metrics-schema.ts
55 lines (53 loc) · 1.91 KB
/
proxy-metrics-schema.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { FromSchema } from 'json-schema-to-ts';
export const proxyMetricsSchema = {
$id: '#/components/schemas/proxyMetricsSchema',
type: 'object',
required: ['appName', 'instanceId', 'bucket'],
properties: {
appName: { type: 'string' },
instanceId: { type: 'string' },
environment: { type: 'string' },
bucket: {
type: 'object',
required: ['start', 'stop', 'toggles'],
properties: {
start: { type: 'string', format: 'date-time' },
stop: { type: 'string', format: 'date-time' },
toggles: {
type: 'object',
example: {
myCoolToggle: {
yes: 25,
no: 42,
variants: {
blue: 6,
green: 15,
red: 46,
},
},
myOtherToggle: {
yes: 0,
no: 100,
},
},
additionalProperties: {
type: 'object',
properties: {
yes: { type: 'integer', minimum: 0 },
no: { type: 'integer', minimum: 0 },
variants: {
type: 'object',
additionalProperties: {
type: 'integer',
minimum: 0,
},
},
},
},
},
},
},
},
components: {},
} as const;
export type ProxyMetricsSchema = FromSchema<typeof proxyMetricsSchema>;