1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-21 13:47:39 +02:00
unleash.unleash/src/lib/openapi/spec/admin-segment-schema.ts
Christopher Kolstad 53354224fc
chore: Bump biome and configure husky (#6589)
Upgrades biome to 1.6.1, and updates husky pre-commit hook.

Most changes here are making type imports explicit.
2024-03-18 13:58:05 +01:00

81 lines
2.6 KiB
TypeScript

import type { 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 feature flags that use this segment. The number also includes the any flags with pending change requests that would add this segment.',
example: 3,
nullable: true,
},
usedInProjects: {
type: 'integer',
minimum: 0,
description:
'The number of projects that use this segment. The number includes any projects with pending change requests that would add 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>;