2023-05-18 10:38:59 +02:00
|
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
|
|
|
|
export const variantFlagSchema = {
|
|
|
|
$id: '#/components/schemas/variantFlagSchema',
|
|
|
|
type: 'object',
|
|
|
|
additionalProperties: false,
|
2023-07-19 17:18:47 +02:00
|
|
|
description: 'A representation of an evaluated Unleash feature variant.',
|
2023-05-18 10:38:59 +02:00
|
|
|
properties: {
|
|
|
|
name: {
|
2023-07-19 17:18:47 +02:00
|
|
|
description:
|
|
|
|
'The name of the variant. Will always be disabled if `enabled` is false.',
|
|
|
|
example: 'blue',
|
2023-05-18 10:38:59 +02:00
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
enabled: {
|
|
|
|
type: 'boolean',
|
2023-07-19 17:18:47 +02:00
|
|
|
description: 'Whether the variant is enabled or not.',
|
|
|
|
example: true,
|
2023-05-18 10:38:59 +02:00
|
|
|
},
|
|
|
|
payload: {
|
|
|
|
type: 'object',
|
2023-07-19 17:18:47 +02:00
|
|
|
description: 'Additional data associated with this variant.',
|
2023-05-18 10:38:59 +02:00
|
|
|
additionalProperties: false,
|
|
|
|
properties: {
|
|
|
|
type: {
|
2023-07-19 17:18:47 +02:00
|
|
|
description: 'The type of data contained.',
|
2023-05-18 10:38:59 +02:00
|
|
|
type: 'string',
|
2023-07-19 17:18:47 +02:00
|
|
|
enum: ['string', 'json', 'csv'],
|
|
|
|
example: 'json',
|
2023-05-18 10:38:59 +02:00
|
|
|
},
|
|
|
|
value: {
|
2023-07-19 17:18:47 +02:00
|
|
|
description: 'The actual associated data',
|
2023-05-18 10:38:59 +02:00
|
|
|
type: 'string',
|
2023-07-19 17:18:47 +02:00
|
|
|
example: '{ "starter": "squirtle" }',
|
2023-05-18 10:38:59 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export type VariantFlagSchema = FromSchema<typeof variantFlagSchema>;
|