1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/openapi/spec/segment-schema.ts
Gastón Fournier 4f78db3be9
fix: segments schemas (#3525)
## About the changes
Remove segment schemas from exceptions

---------

Co-authored-by: GitHub Actions Bot <>
2023-04-17 10:51:48 +02:00

44 lines
1.2 KiB
TypeScript

import { FromSchema } from 'json-schema-to-ts';
import { constraintSchema } from './constraint-schema';
export const segmentSchema = {
$id: '#/components/schemas/segmentSchema',
type: 'object',
description:
'Represents a segment of users defined by a set of constraints.',
additionalProperties: false,
required: ['id', 'constraints'],
properties: {
id: {
type: 'number',
description: "The segment's id.",
},
name: {
type: 'string',
description: 'The name of the segment.',
example: 'segment A',
},
description: {
type: 'string',
nullable: true,
description: 'The description of the segment.',
example: 'Segment A description',
},
constraints: {
type: 'array',
description:
'List of constraints that determine which users are part of the segment',
items: {
$ref: '#/components/schemas/constraintSchema',
},
},
},
components: {
schemas: {
constraintSchema,
},
},
} as const;
export type SegmentSchema = FromSchema<typeof segmentSchema>;