mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
68 lines
2.3 KiB
TypeScript
68 lines
2.3 KiB
TypeScript
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
export const proxyFeatureSchema = {
|
|
$id: '#/components/schemas/proxyFeatureSchema',
|
|
type: 'object',
|
|
required: ['name', 'enabled', 'impressionData'],
|
|
additionalProperties: false,
|
|
description: 'Frontend API feature',
|
|
properties: {
|
|
name: {
|
|
type: 'string',
|
|
example: 'disable-comments',
|
|
description: 'Unique feature name.',
|
|
},
|
|
enabled: {
|
|
type: 'boolean',
|
|
example: true,
|
|
description: 'Always set to `true`.',
|
|
},
|
|
impressionData: {
|
|
type: 'boolean',
|
|
example: false,
|
|
description:
|
|
'`true` if the impression data collection is enabled for the feature, otherwise `false`.',
|
|
},
|
|
variant: {
|
|
type: 'object',
|
|
required: ['name', 'enabled'],
|
|
additionalProperties: false,
|
|
description: 'Variant details',
|
|
properties: {
|
|
name: {
|
|
type: 'string',
|
|
description:
|
|
'The variants name. Is unique for this feature toggle',
|
|
example: 'blue_group',
|
|
},
|
|
enabled: {
|
|
type: 'boolean',
|
|
example: true,
|
|
description: 'Whether the variant is enabled or not.',
|
|
},
|
|
payload: {
|
|
type: 'object',
|
|
additionalProperties: false,
|
|
required: ['type', 'value'],
|
|
description: 'Extra data configured for this variant',
|
|
example: { type: 'json', value: '{"color": "red"}' },
|
|
properties: {
|
|
type: {
|
|
type: 'string',
|
|
description: 'The format of the payload.',
|
|
enum: ['json', 'csv', 'string'],
|
|
},
|
|
value: {
|
|
type: 'string',
|
|
description: 'The payload value stringified.',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
components: {},
|
|
} as const;
|
|
|
|
export type ProxyFeatureSchema = FromSchema<typeof proxyFeatureSchema>;
|