2022-06-27 10:17:44 +02:00
|
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
import { featureEnvironmentMetricsSchema } from './feature-environment-metrics-schema';
|
2023-04-26 12:10:57 +02:00
|
|
|
import { dateSchema } from './date-schema';
|
2022-06-27 10:17:44 +02:00
|
|
|
|
|
|
|
export const featureUsageSchema = {
|
|
|
|
$id: '#/components/schemas/featureUsageSchema',
|
|
|
|
type: 'object',
|
|
|
|
additionalProperties: false,
|
2023-04-26 12:10:57 +02:00
|
|
|
description:
|
|
|
|
'How many applications have seen this feature toggle, as well as how this feature was evaluated the last hour',
|
2022-06-27 10:17:44 +02:00
|
|
|
required: [
|
|
|
|
'version',
|
|
|
|
'maturity',
|
|
|
|
'featureName',
|
|
|
|
'lastHourUsage',
|
|
|
|
'seenApplications',
|
|
|
|
],
|
|
|
|
properties: {
|
|
|
|
version: {
|
2023-04-26 12:10:57 +02:00
|
|
|
description: 'The version of this schema',
|
|
|
|
type: 'integer',
|
|
|
|
minimum: 1,
|
2022-06-27 10:17:44 +02:00
|
|
|
},
|
|
|
|
maturity: {
|
2023-04-26 12:10:57 +02:00
|
|
|
description:
|
|
|
|
'The maturity level of this API (alpha, beta, stable, deprecated)',
|
2022-06-27 10:17:44 +02:00
|
|
|
type: 'string',
|
2023-04-26 12:10:57 +02:00
|
|
|
example: 'stable',
|
2022-06-27 10:17:44 +02:00
|
|
|
},
|
|
|
|
featureName: {
|
2023-04-26 12:10:57 +02:00
|
|
|
description: 'The name of the feature',
|
2022-06-27 10:17:44 +02:00
|
|
|
type: 'string',
|
2023-04-26 12:10:57 +02:00
|
|
|
example: 'my.special.feature',
|
2022-06-27 10:17:44 +02:00
|
|
|
},
|
|
|
|
lastHourUsage: {
|
2023-04-26 12:10:57 +02:00
|
|
|
description:
|
|
|
|
'Last hour statistics. Accumulated per feature per environment. Contains counts for evaluations to true (yes) and to false (no)',
|
2022-06-27 10:17:44 +02:00
|
|
|
type: 'array',
|
|
|
|
items: {
|
|
|
|
$ref: '#/components/schemas/featureEnvironmentMetricsSchema',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
seenApplications: {
|
2023-04-26 12:10:57 +02:00
|
|
|
description: 'A list of applications seen using this feature',
|
2022-06-27 10:17:44 +02:00
|
|
|
type: 'array',
|
|
|
|
items: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
2023-04-26 12:10:57 +02:00
|
|
|
example: ['accounting', 'billing', 'booking'],
|
2022-06-27 10:17:44 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
schemas: {
|
|
|
|
featureEnvironmentMetricsSchema,
|
2023-04-26 12:10:57 +02:00
|
|
|
dateSchema,
|
2022-06-27 10:17:44 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export type FeatureUsageSchema = FromSchema<typeof featureUsageSchema>;
|