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/validate-feature-schema.ts
Jaanus Sellin 53f90d37c5
feat: feature naming patterns (#4591)
Adds a first iteration of feature flag naming patterns. Currently behind a flag.

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.io>
Co-authored-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-09-04 11:53:33 +00:00

26 lines
875 B
TypeScript

import { FromSchema } from 'json-schema-to-ts';
export const validateFeatureSchema = {
$id: '#/components/schemas/validateFeatureSchema',
type: 'object',
required: ['name'],
description: "Data used to validate a feature toggle's name.",
properties: {
name: {
description: 'The feature name to validate.',
type: 'string',
example: 'my-feature-3',
},
projectId: {
description:
'The id of the project that the feature flag will belong to. If the target project has a feature naming pattern defined, the name will be validated against that pattern.',
nullable: true,
type: 'string',
example: 'project-y',
},
},
components: {},
} as const;
export type ValidateFeatureSchema = FromSchema<typeof validateFeatureSchema>;