1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-17 13:46:47 +02:00
unleash.unleash/src/lib/openapi/spec/variant-flag-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

54 lines
1.7 KiB
TypeScript

import type { FromSchema } from 'json-schema-to-ts';
export const variantFlagSchema = {
$id: '#/components/schemas/variantFlagSchema',
type: 'object',
additionalProperties: false,
description: 'A representation of an evaluated Unleash feature variant.',
properties: {
name: {
description:
'The name of the variant. Will always be disabled if `enabled` is false.',
example: 'blue',
type: 'string',
},
enabled: {
type: 'boolean',
description: 'Whether the variant is enabled or not.',
example: true,
},
payload: {
type: 'object',
description: 'Additional data associated with this variant.',
additionalProperties: false,
properties: {
type: {
description: 'The type of data contained.',
type: 'string',
enum: ['string', 'json', 'csv', 'number'],
example: 'json',
},
value: {
description: 'The actual associated data',
type: 'string',
example: '{ "starter": "squirtle" }',
},
},
},
feature_enabled: {
type: 'boolean',
description: 'Whether the feature is enabled or not.',
example: true,
},
featureEnabled: {
deprecated: true,
type: 'boolean',
description: 'Use `feature_enabled` instead.',
example: true,
},
},
components: {},
} as const;
export type VariantFlagSchema = FromSchema<typeof variantFlagSchema>;