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/variant-schema.ts
olav 59060ed3ea
refactor: improve OpenAPI refs (#1620)
* refactor: simplify FeatureEnvironmentSchema name

* refactor: format schema files

* fix: pass nested schemas to FromSchema

* refactor: remove ref order note

* refactor: fix overly strict required fields

* refactor: clean up mapper names and paths

* refactor: replace mappers with optional fields
2022-05-24 08:37:35 +02:00

48 lines
1.1 KiB
TypeScript

import { createSchemaObject, CreateSchemaType } from '../types';
import { overrideSchema } from './override-schema';
const schema = {
type: 'object',
additionalProperties: false,
required: ['name', 'weight', 'weightType', 'stickiness'],
properties: {
name: {
type: 'string',
},
weight: {
type: 'number',
},
weightType: {
type: 'string',
},
stickiness: {
type: 'string',
},
payload: {
type: 'object',
required: ['type', 'value'],
properties: {
type: {
type: 'string',
},
value: {
type: 'string',
},
},
},
overrides: {
type: 'array',
items: {
$ref: '#/components/schemas/overrideSchema',
},
},
},
'components/schemas': {
overrideSchema,
},
} as const;
export type VariantSchema = CreateSchemaType<typeof schema>;
export const variantSchema = createSchemaObject(schema);