1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/src/lib/openapi/spec/feature-usage-schema.ts
Christopher Kolstad 53354224fc
chore: Bump biome and configure husky (#6589)
Upgrades biome to 1.6.1, and updates husky pre-commit hook.

Most changes here are making type imports explicit.
2024-03-18 13:58:05 +01:00

61 lines
1.9 KiB
TypeScript

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