1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-09 00:18:26 +01:00
unleash.unleash/src/lib/openapi/spec/playground-segment-schema.ts
Thomas Heartman df59b10fb6
OpenAPI: more schema cleanup (#4353)
This PR fixes additional schemas that hadn't been described properly
2023-07-28 06:59:05 +00:00

40 lines
1.2 KiB
TypeScript

import { FromSchema } from 'json-schema-to-ts';
import { playgroundConstraintSchema } from './playground-constraint-schema';
export const playgroundSegmentSchema = {
$id: '#/components/schemas/playgroundSegmentSchema',
type: 'object',
additionalProperties: false,
description: 'The evaluated result of a segment as used by the Playground.',
required: ['name', 'id', 'constraints', 'result'],
properties: {
id: {
description: "The segment's id.",
type: 'integer',
},
name: {
description: 'The name of the segment.',
example: 'segment A',
type: 'string',
},
result: {
description: 'Whether this was evaluated as true or false.',
type: 'boolean',
},
constraints: {
type: 'array',
description: 'The list of constraints in this segment.',
items: { $ref: playgroundConstraintSchema.$id },
},
},
components: {
schemas: {
playgroundConstraintSchema,
},
},
} as const;
export type PlaygroundSegmentSchema = FromSchema<
typeof playgroundSegmentSchema
>;