mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
79 lines
2.4 KiB
TypeScript
79 lines
2.4 KiB
TypeScript
|
import { FromSchema } from 'json-schema-to-ts';
|
||
|
import { constraintSchema } from './constraint-schema';
|
||
|
|
||
|
export const adminSegmentSchema = {
|
||
|
$id: '#/components/schemas/adminSegmentSchema',
|
||
|
type: 'object',
|
||
|
required: ['id', 'name', 'constraints', 'createdAt'],
|
||
|
description:
|
||
|
'A description of a [segment](https://docs.getunleash.io/reference/segments)',
|
||
|
additionalProperties: false,
|
||
|
properties: {
|
||
|
id: {
|
||
|
type: 'integer',
|
||
|
description: 'The ID of this segment',
|
||
|
example: 2,
|
||
|
minimum: 0,
|
||
|
},
|
||
|
name: {
|
||
|
type: 'string',
|
||
|
description: 'The name of this segment',
|
||
|
example: 'ios-users',
|
||
|
},
|
||
|
description: {
|
||
|
type: 'string',
|
||
|
nullable: true,
|
||
|
description: 'The description for this segment',
|
||
|
example: 'IOS users segment',
|
||
|
},
|
||
|
constraints: {
|
||
|
type: 'array',
|
||
|
description:
|
||
|
'The list of constraints that are used in this segment',
|
||
|
items: {
|
||
|
$ref: '#/components/schemas/constraintSchema',
|
||
|
},
|
||
|
},
|
||
|
usedInFeatures: {
|
||
|
type: 'integer',
|
||
|
minimum: 0,
|
||
|
description: 'The number of projects that use this segment',
|
||
|
example: 3,
|
||
|
nullable: true,
|
||
|
},
|
||
|
usedInProjects: {
|
||
|
type: 'integer',
|
||
|
minimum: 0,
|
||
|
description: 'The number of projects that use this segment',
|
||
|
example: 2,
|
||
|
nullable: true,
|
||
|
},
|
||
|
project: {
|
||
|
type: 'string',
|
||
|
nullable: true,
|
||
|
example: 'red-vista',
|
||
|
description:
|
||
|
'The project the segment belongs to. Only present if the segment is a project-specific segment.',
|
||
|
},
|
||
|
createdBy: {
|
||
|
description: "The creator's email or username",
|
||
|
example: 'someone@example.com',
|
||
|
type: 'string',
|
||
|
nullable: true,
|
||
|
},
|
||
|
createdAt: {
|
||
|
type: 'string',
|
||
|
format: 'date-time',
|
||
|
description: 'When the segment was created',
|
||
|
example: '2023-04-12T11:13:31.960Z',
|
||
|
},
|
||
|
},
|
||
|
components: {
|
||
|
schemas: {
|
||
|
constraintSchema,
|
||
|
},
|
||
|
},
|
||
|
} as const;
|
||
|
|
||
|
export type AdminSegmentSchema = FromSchema<typeof adminSegmentSchema>;
|