mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
59060ed3ea
* 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
48 lines
1.1 KiB
TypeScript
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);
|