2022-06-22 09:09:49 +02:00
|
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
import { constraintSchema } from './constraint-schema';
|
|
|
|
|
|
|
|
export const segmentSchema = {
|
|
|
|
$id: '#/components/schemas/segmentSchema',
|
|
|
|
type: 'object',
|
2023-04-17 10:51:48 +02:00
|
|
|
description:
|
|
|
|
'Represents a segment of users defined by a set of constraints.',
|
2022-06-22 09:09:49 +02:00
|
|
|
additionalProperties: false,
|
2022-06-30 11:54:14 +02:00
|
|
|
required: ['id', 'constraints'],
|
2022-06-22 09:09:49 +02:00
|
|
|
properties: {
|
2022-06-30 11:54:14 +02:00
|
|
|
id: {
|
|
|
|
type: 'number',
|
2023-04-17 10:51:48 +02:00
|
|
|
description: "The segment's id.",
|
2022-06-30 11:54:14 +02:00
|
|
|
},
|
2022-06-22 09:09:49 +02:00
|
|
|
name: {
|
|
|
|
type: 'string',
|
2023-04-17 10:51:48 +02:00
|
|
|
description: 'The name of the segment.',
|
|
|
|
example: 'segment A',
|
2022-06-22 09:09:49 +02:00
|
|
|
},
|
|
|
|
description: {
|
|
|
|
type: 'string',
|
2022-06-30 11:54:14 +02:00
|
|
|
nullable: true,
|
2023-04-17 10:51:48 +02:00
|
|
|
description: 'The description of the segment.',
|
|
|
|
example: 'Segment A description',
|
2022-06-22 09:09:49 +02:00
|
|
|
},
|
|
|
|
constraints: {
|
|
|
|
type: 'array',
|
2023-04-12 11:29:51 +02:00
|
|
|
description:
|
|
|
|
'List of constraints that determine which users are part of the segment',
|
2022-06-22 09:09:49 +02:00
|
|
|
items: {
|
|
|
|
$ref: '#/components/schemas/constraintSchema',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
schemas: {
|
|
|
|
constraintSchema,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export type SegmentSchema = FromSchema<typeof segmentSchema>;
|