mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-14 00:19:16 +01:00
feat: add schema for change request strategies (#5578)
This change adds a property to the segmentStrategiesSchema to make sure that change request strategies are listed in the openapi spec It also renames the files that contains that schema and its tests from `admin-strategies-schema` to `segment-strategies-schema`.
This commit is contained in:
parent
0060697c01
commit
fb5a487663
@ -22,7 +22,7 @@ import {
|
|||||||
getStandardResponses,
|
getStandardResponses,
|
||||||
} from '../../openapi/util/standard-responses';
|
} from '../../openapi/util/standard-responses';
|
||||||
import { ISegmentService } from '../../segments/segment-service-interface';
|
import { ISegmentService } from '../../segments/segment-service-interface';
|
||||||
import { SegmentStrategiesSchema } from '../../openapi/spec/admin-strategies-schema';
|
import { SegmentStrategiesSchema } from '../../openapi/spec/segment-strategies-schema';
|
||||||
import { AccessService, OpenApiService } from '../../services';
|
import { AccessService, OpenApiService } from '../../services';
|
||||||
import {
|
import {
|
||||||
CREATE_SEGMENT,
|
CREATE_SEGMENT,
|
||||||
@ -156,7 +156,7 @@ export class SegmentsController extends Controller {
|
|||||||
description:
|
description:
|
||||||
'Retrieve all strategies that reference the specified segment.',
|
'Retrieve all strategies that reference the specified segment.',
|
||||||
responses: {
|
responses: {
|
||||||
200: createResponseSchema('adminStrategiesSchema'),
|
200: createResponseSchema('segmentStrategiesSchema'),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -187,7 +187,7 @@ import { createApplicationSchema } from './spec/create-application-schema';
|
|||||||
import { contextFieldStrategiesSchema } from './spec/context-field-strategies-schema';
|
import { contextFieldStrategiesSchema } from './spec/context-field-strategies-schema';
|
||||||
import { advancedPlaygroundEnvironmentFeatureSchema } from './spec/advanced-playground-environment-feature-schema';
|
import { advancedPlaygroundEnvironmentFeatureSchema } from './spec/advanced-playground-environment-feature-schema';
|
||||||
import { createFeatureNamingPatternSchema } from './spec/create-feature-naming-pattern-schema';
|
import { createFeatureNamingPatternSchema } from './spec/create-feature-naming-pattern-schema';
|
||||||
import { segmentStrategiesSchema } from './spec/admin-strategies-schema';
|
import { segmentStrategiesSchema } from './spec/segment-strategies-schema';
|
||||||
import { featureDependenciesSchema } from './spec/feature-dependencies-schema';
|
import { featureDependenciesSchema } from './spec/feature-dependencies-schema';
|
||||||
|
|
||||||
// Schemas must have an $id property on the form "#/components/schemas/mySchema".
|
// Schemas must have an $id property on the form "#/components/schemas/mySchema".
|
||||||
@ -223,7 +223,7 @@ export const schemas: UnleashSchemas = {
|
|||||||
adminCountSchema,
|
adminCountSchema,
|
||||||
adminFeaturesQuerySchema,
|
adminFeaturesQuerySchema,
|
||||||
adminSegmentSchema,
|
adminSegmentSchema,
|
||||||
adminStrategiesSchema: segmentStrategiesSchema,
|
segmentStrategiesSchema,
|
||||||
addonParameterSchema,
|
addonParameterSchema,
|
||||||
addonSchema,
|
addonSchema,
|
||||||
addonCreateUpdateSchema,
|
addonCreateUpdateSchema,
|
||||||
|
@ -5,6 +5,7 @@ export const segmentStrategiesSchema = {
|
|||||||
type: 'object',
|
type: 'object',
|
||||||
required: ['strategies'],
|
required: ['strategies'],
|
||||||
description: 'A collection of strategies belonging to a specified segment.',
|
description: 'A collection of strategies belonging to a specified segment.',
|
||||||
|
additionalProperties: false,
|
||||||
properties: {
|
properties: {
|
||||||
strategies: {
|
strategies: {
|
||||||
description: 'The list of strategies',
|
description: 'The list of strategies',
|
||||||
@ -50,6 +51,51 @@ export const segmentStrategiesSchema = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
changeRequestStrategies: {
|
||||||
|
description:
|
||||||
|
'A list of strategies that use this segment in active change requests.',
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'object',
|
||||||
|
required: [
|
||||||
|
'featureName',
|
||||||
|
'projectId',
|
||||||
|
'environment',
|
||||||
|
'strategyName',
|
||||||
|
],
|
||||||
|
properties: {
|
||||||
|
id: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
"The ID of the strategy. Not present on new strategies that haven't been added to the feature flag yet.",
|
||||||
|
example: 'e465c813-cffb-4232-b184-82b1d6fe9d3d',
|
||||||
|
},
|
||||||
|
featureName: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'The name of the feature flag that this strategy belongs to.',
|
||||||
|
example: 'new-signup-flow',
|
||||||
|
},
|
||||||
|
projectId: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'The ID of the project that the strategy belongs to.',
|
||||||
|
example: 'red-vista',
|
||||||
|
},
|
||||||
|
environment: {
|
||||||
|
type: 'string',
|
||||||
|
description:
|
||||||
|
'The ID of the environment that the strategy belongs to.',
|
||||||
|
example: 'development',
|
||||||
|
},
|
||||||
|
strategyName: {
|
||||||
|
type: 'string',
|
||||||
|
description: "The name of the strategy's type.",
|
||||||
|
example: 'flexibleRollout',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
} as const;
|
} as const;
|
Loading…
Reference in New Issue
Block a user