mirror of
https://github.com/Unleash/unleash.git
synced 2025-11-10 01:19:53 +01:00
refactor: move release plan schemas to OSS (#10748)
This commit is contained in:
parent
f01f747c9b
commit
5e2d95e0be
@ -170,6 +170,11 @@ export * from './public-signup-token-update-schema.js';
|
|||||||
export * from './public-signup-tokens-schema.js';
|
export * from './public-signup-tokens-schema.js';
|
||||||
export * from './push-variants-schema.js';
|
export * from './push-variants-schema.js';
|
||||||
export * from './record-ui-error-schema.js';
|
export * from './record-ui-error-schema.js';
|
||||||
|
export * from './release-plan-milestone-schema.js';
|
||||||
|
export * from './release-plan-milestone-strategy-schema.js';
|
||||||
|
export * from './release-plan-schema.js';
|
||||||
|
export * from './release-plan-template-id-schema.js';
|
||||||
|
export * from './release-plan-template-schema.js';
|
||||||
export * from './requests-per-second-schema.js';
|
export * from './requests-per-second-schema.js';
|
||||||
export * from './requests-per-second-segmented-schema.js';
|
export * from './requests-per-second-segmented-schema.js';
|
||||||
export * from './reset-password-schema.js';
|
export * from './reset-password-schema.js';
|
||||||
|
|||||||
60
src/lib/openapi/spec/release-plan-milestone-schema.ts
Normal file
60
src/lib/openapi/spec/release-plan-milestone-schema.ts
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import type { FromSchema } from 'json-schema-to-ts';
|
||||||
|
import { releasePlanMilestoneStrategySchema } from './release-plan-milestone-strategy-schema.js';
|
||||||
|
import { createFeatureStrategySchema } from './create-feature-strategy-schema.js';
|
||||||
|
import { parametersSchema } from './parameters-schema.js';
|
||||||
|
import { constraintSchema } from './constraint-schema.js';
|
||||||
|
import { createStrategyVariantSchema } from './create-strategy-variant-schema.js';
|
||||||
|
|
||||||
|
export const releasePlanMilestoneSchema = {
|
||||||
|
$id: '#/components/schemas/releasePlanMilestoneSchema',
|
||||||
|
additionalProperties: false,
|
||||||
|
description:
|
||||||
|
'Schema representing the creation of a release plan milestone.',
|
||||||
|
type: 'object',
|
||||||
|
required: ['id', 'name', 'sortOrder', 'releasePlanDefinitionId'],
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string',
|
||||||
|
description: "The milestone's ID. Milestone IDs are ulids.",
|
||||||
|
example: '01JB9GGTGQYEQ9D40R17T3YVW1',
|
||||||
|
nullable: false,
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string',
|
||||||
|
description: 'The name of the milestone.',
|
||||||
|
example: 'My milestone',
|
||||||
|
},
|
||||||
|
sortOrder: {
|
||||||
|
type: 'integer',
|
||||||
|
description: 'The order of the milestone in the release plan.',
|
||||||
|
example: 1,
|
||||||
|
},
|
||||||
|
releasePlanDefinitionId: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'The ID of the release plan/template that this milestone belongs to.',
|
||||||
|
example: '01JB9GGTGQYEQ9D40R17T3YVW2',
|
||||||
|
},
|
||||||
|
strategies: {
|
||||||
|
type: 'array',
|
||||||
|
description:
|
||||||
|
'A list of strategies that are attached to this milestone.',
|
||||||
|
items: {
|
||||||
|
$ref: '#/components/schemas/releasePlanMilestoneStrategySchema',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
schemas: {
|
||||||
|
releasePlanMilestoneStrategySchema,
|
||||||
|
createFeatureStrategySchema,
|
||||||
|
parametersSchema,
|
||||||
|
constraintSchema,
|
||||||
|
createStrategyVariantSchema,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ReleasePlanMilestoneSchema = FromSchema<
|
||||||
|
typeof releasePlanMilestoneSchema
|
||||||
|
>;
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
import type { FromSchema } from 'json-schema-to-ts';
|
||||||
|
import { createFeatureStrategySchema } from './create-feature-strategy-schema.js';
|
||||||
|
import { parametersSchema } from './parameters-schema.js';
|
||||||
|
import { constraintSchema } from './constraint-schema.js';
|
||||||
|
import { createStrategyVariantSchema } from './create-strategy-variant-schema.js';
|
||||||
|
|
||||||
|
export const releasePlanMilestoneStrategySchema = {
|
||||||
|
$id: '#/components/schemas/releasePlanMilestoneStrategySchema',
|
||||||
|
additionalProperties: false,
|
||||||
|
description:
|
||||||
|
'Schema representing the creation of a release plan milestone strategy.',
|
||||||
|
type: 'object',
|
||||||
|
required: ['id', 'milestoneId', 'sortOrder', 'strategyName'],
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
"The milestone strategy's ID. Milestone strategy IDs are ulids.",
|
||||||
|
example: '01JB9GGTGQYEQ9D40R17T3YVW3',
|
||||||
|
nullable: false,
|
||||||
|
},
|
||||||
|
milestoneId: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'The ID of the milestone that this strategy belongs to.',
|
||||||
|
example: '01JB9GGTGQYEQ9D40R17T3YVW1',
|
||||||
|
},
|
||||||
|
sortOrder: createFeatureStrategySchema.properties.sortOrder,
|
||||||
|
title: createFeatureStrategySchema.properties.title,
|
||||||
|
strategyName: createFeatureStrategySchema.properties.name,
|
||||||
|
parameters: createFeatureStrategySchema.properties.parameters,
|
||||||
|
constraints: createFeatureStrategySchema.properties.constraints,
|
||||||
|
variants: createFeatureStrategySchema.properties.variants,
|
||||||
|
segments: createFeatureStrategySchema.properties.segments,
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
schemas: {
|
||||||
|
createFeatureStrategySchema,
|
||||||
|
parametersSchema,
|
||||||
|
constraintSchema,
|
||||||
|
createStrategyVariantSchema,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ReleasePlanMilestoneStrategySchema = FromSchema<
|
||||||
|
typeof releasePlanMilestoneStrategySchema
|
||||||
|
>;
|
||||||
78
src/lib/openapi/spec/release-plan-schema.ts
Normal file
78
src/lib/openapi/spec/release-plan-schema.ts
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
import type { FromSchema } from 'json-schema-to-ts';
|
||||||
|
import { releasePlanMilestoneSchema } from './release-plan-milestone-schema.js';
|
||||||
|
import { releasePlanTemplateSchema } from './release-plan-template-schema.js';
|
||||||
|
import { releasePlanMilestoneStrategySchema } from './release-plan-milestone-strategy-schema.js';
|
||||||
|
import { constraintSchema } from './constraint-schema.js';
|
||||||
|
import { createFeatureStrategySchema } from './create-feature-strategy-schema.js';
|
||||||
|
import { createStrategyVariantSchema } from './create-strategy-variant-schema.js';
|
||||||
|
import { parametersSchema } from './parameters-schema.js';
|
||||||
|
|
||||||
|
export const releasePlanSchema = {
|
||||||
|
$id: '#/components/schemas/releasePlanSchema',
|
||||||
|
additionalProperties: false,
|
||||||
|
description: 'Schema representing the creation of a release plan.',
|
||||||
|
type: 'object',
|
||||||
|
required: [
|
||||||
|
'id',
|
||||||
|
'discriminator',
|
||||||
|
'name',
|
||||||
|
'featureName',
|
||||||
|
'environment',
|
||||||
|
'createdByUserId',
|
||||||
|
'createdAt',
|
||||||
|
'milestones',
|
||||||
|
'releasePlanTemplateId',
|
||||||
|
],
|
||||||
|
properties: {
|
||||||
|
id: releasePlanTemplateSchema.properties.id,
|
||||||
|
discriminator: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'A field to distinguish between release plans and release templates.',
|
||||||
|
example: 'plan',
|
||||||
|
nullable: false,
|
||||||
|
enum: ['plan'],
|
||||||
|
},
|
||||||
|
name: releasePlanTemplateSchema.properties.name,
|
||||||
|
description: releasePlanTemplateSchema.properties.description,
|
||||||
|
featureName: {
|
||||||
|
type: 'string',
|
||||||
|
description: 'The name of the feature that uses this release plan.',
|
||||||
|
example: 'my-feature',
|
||||||
|
},
|
||||||
|
environment: {
|
||||||
|
type: 'string',
|
||||||
|
description: 'The environment that this release plan is for.',
|
||||||
|
example: 'production',
|
||||||
|
},
|
||||||
|
createdByUserId: releasePlanTemplateSchema.properties.createdByUserId,
|
||||||
|
createdAt: releasePlanTemplateSchema.properties.createdAt,
|
||||||
|
activeMilestoneId: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'The ID of the currently active milestone in this release plan.',
|
||||||
|
example: '01JB9GGTGQYEQ9D40R17T3YVW1',
|
||||||
|
nullable: true,
|
||||||
|
},
|
||||||
|
milestones: releasePlanTemplateSchema.properties.milestones,
|
||||||
|
releasePlanTemplateId: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'The ID of the release plan template that this release plan is based on.',
|
||||||
|
example: '01JB9GGTGQYEQ9D40R17T3YVW2',
|
||||||
|
nullable: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
schemas: {
|
||||||
|
releasePlanMilestoneSchema,
|
||||||
|
releasePlanMilestoneStrategySchema,
|
||||||
|
createFeatureStrategySchema,
|
||||||
|
parametersSchema,
|
||||||
|
constraintSchema,
|
||||||
|
createStrategyVariantSchema,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ReleasePlanSchema = FromSchema<typeof releasePlanSchema>;
|
||||||
24
src/lib/openapi/spec/release-plan-template-id-schema.ts
Normal file
24
src/lib/openapi/spec/release-plan-template-id-schema.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import type { FromSchema } from 'json-schema-to-ts';
|
||||||
|
|
||||||
|
export const releasePlanTemplateIdSchema = {
|
||||||
|
$id: '#/components/schemas/releasePlanTemplateIdSchema',
|
||||||
|
additionalProperties: false,
|
||||||
|
description:
|
||||||
|
'Schema for creating a release plan for a feature flag environment by copying and applying the configuration from a release plan template.',
|
||||||
|
type: 'object',
|
||||||
|
required: ['templateId'],
|
||||||
|
properties: {
|
||||||
|
templateId: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
"The release plan template's ID. Release template IDs are ulids.",
|
||||||
|
example: '01JB9GGTGQYEQ9D40R17T3YVW2',
|
||||||
|
nullable: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ReleasePlanTemplateIdSchema = FromSchema<
|
||||||
|
typeof releasePlanTemplateIdSchema
|
||||||
|
>;
|
||||||
87
src/lib/openapi/spec/release-plan-template-schema.ts
Normal file
87
src/lib/openapi/spec/release-plan-template-schema.ts
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import type { FromSchema } from 'json-schema-to-ts';
|
||||||
|
import { releasePlanMilestoneSchema } from './release-plan-milestone-schema.js';
|
||||||
|
import { releasePlanMilestoneStrategySchema } from './release-plan-milestone-strategy-schema.js';
|
||||||
|
import { createFeatureStrategySchema } from './create-feature-strategy-schema.js';
|
||||||
|
import { parametersSchema } from './parameters-schema.js';
|
||||||
|
import { constraintSchema } from './constraint-schema.js';
|
||||||
|
import { createStrategyVariantSchema } from './create-strategy-variant-schema.js';
|
||||||
|
|
||||||
|
export const releasePlanTemplateSchema = {
|
||||||
|
$id: '#/components/schemas/releasePlanTemplateSchema',
|
||||||
|
additionalProperties: false,
|
||||||
|
description: 'Schema representing the creation of a release template.',
|
||||||
|
type: 'object',
|
||||||
|
required: ['id', 'discriminator', 'name', 'createdByUserId', 'createdAt'],
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
"The release plan/template's ID. Release template IDs are ulids.",
|
||||||
|
example: '01JB9GGTGQYEQ9D40R17T3YVW2',
|
||||||
|
nullable: false,
|
||||||
|
},
|
||||||
|
discriminator: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'A field to distinguish between release plans and release templates.',
|
||||||
|
example: 'template',
|
||||||
|
nullable: false,
|
||||||
|
enum: ['template'],
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: 'string',
|
||||||
|
description: 'The name of the release template.',
|
||||||
|
example: 'My release plan',
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
type: 'string',
|
||||||
|
description: 'A description of the release template.',
|
||||||
|
example: 'This is my release plan',
|
||||||
|
nullable: true,
|
||||||
|
},
|
||||||
|
createdByUserId: {
|
||||||
|
type: 'number',
|
||||||
|
description:
|
||||||
|
'Release template: The ID of the user who created this template.',
|
||||||
|
example: 53,
|
||||||
|
nullable: false,
|
||||||
|
},
|
||||||
|
createdAt: {
|
||||||
|
type: 'string',
|
||||||
|
format: 'date-time',
|
||||||
|
description:
|
||||||
|
'The date and time that the release template was created.',
|
||||||
|
example: '2022-01-01T00:00:00Z',
|
||||||
|
nullable: false,
|
||||||
|
},
|
||||||
|
milestones: {
|
||||||
|
type: 'array',
|
||||||
|
description: 'A list of the milestones in this release template.',
|
||||||
|
items: {
|
||||||
|
$ref: '#/components/schemas/releasePlanMilestoneSchema',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
archivedAt: {
|
||||||
|
type: 'string',
|
||||||
|
format: 'date-time',
|
||||||
|
description:
|
||||||
|
'The date and time that the release template was archived.',
|
||||||
|
example: '2022-01-01T00:00:00Z',
|
||||||
|
nullable: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
schemas: {
|
||||||
|
releasePlanMilestoneSchema,
|
||||||
|
releasePlanMilestoneStrategySchema,
|
||||||
|
createFeatureStrategySchema,
|
||||||
|
parametersSchema,
|
||||||
|
constraintSchema,
|
||||||
|
createStrategyVariantSchema,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export type ReleasePlanTemplateSchema = FromSchema<
|
||||||
|
typeof releasePlanTemplateSchema
|
||||||
|
>;
|
||||||
Loading…
Reference in New Issue
Block a user