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/state-schema.ts

108 lines
3.1 KiB
TypeScript
Raw Normal View History

import { FromSchema } from 'json-schema-to-ts';
import { featureSchema } from './feature-schema';
import { strategySchema } from './strategy-schema';
import { tagSchema } from './tag-schema';
import { tagTypeSchema } from './tag-type-schema';
import { featureTagSchema } from './feature-tag-schema';
import { projectSchema } from './project-schema';
import { featureStrategySchema } from './feature-strategy-schema';
import { featureEnvironmentSchema } from './feature-environment-schema';
import { environmentSchema } from './environment-schema';
import { segmentSchema } from './segment-schema';
import { featureStrategySegmentSchema } from './feature-strategy-segment-schema';
export const stateSchema = {
$id: '#/components/schemas/stateSchema',
type: 'object',
additionalProperties: true,
required: ['version'],
properties: {
version: {
type: 'integer',
},
features: {
type: 'array',
items: {
$ref: '#/components/schemas/featureSchema',
},
},
strategies: {
type: 'array',
items: {
$ref: '#/components/schemas/strategySchema',
},
},
tags: {
type: 'array',
items: {
$ref: '#/components/schemas/tagSchema',
},
},
tagTypes: {
type: 'array',
items: {
$ref: '#/components/schemas/tagTypeSchema',
},
},
featureTags: {
type: 'array',
items: {
$ref: '#/components/schemas/featureTagSchema',
},
},
projects: {
type: 'array',
items: {
$ref: '#/components/schemas/projectSchema',
},
},
featureStrategies: {
type: 'array',
items: {
$ref: '#/components/schemas/featureStrategySchema',
},
},
featureEnvironments: {
type: 'array',
items: {
$ref: '#/components/schemas/featureEnvironmentSchema',
},
},
environments: {
type: 'array',
items: {
$ref: '#/components/schemas/environmentSchema',
},
},
segments: {
type: 'array',
items: {
$ref: '#/components/schemas/segmentSchema',
},
},
featureStrategySegments: {
type: 'array',
items: {
$ref: '#/components/schemas/featureStrategySegmentSchema',
},
},
},
components: {
schemas: {
featureSchema,
strategySchema,
tagSchema,
tagTypeSchema,
featureTagSchema,
projectSchema,
featureStrategySchema,
featureEnvironmentSchema,
environmentSchema,
segmentSchema,
featureStrategySegmentSchema,
},
},
} as const;
export type StateSchema = FromSchema<typeof stateSchema>;