mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-01 01:18:10 +02:00
parent
f8473a243f
commit
e226e31ad5
@ -120,6 +120,7 @@ export class FeatureEnvironmentStore implements IFeatureEnvironmentStore {
|
|||||||
enabled: r.enabled,
|
enabled: r.enabled,
|
||||||
featureName: r.feature_name,
|
featureName: r.feature_name,
|
||||||
environment: r.environment,
|
environment: r.environment,
|
||||||
|
variants: r.variants,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,15 +5,99 @@ test('exportResultSchema', () => {
|
|||||||
const data: ExportResultSchema = {
|
const data: ExportResultSchema = {
|
||||||
features: [
|
features: [
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'some-toggle1',
|
||||||
|
description: '',
|
||||||
|
type: 'release',
|
||||||
|
project: 'myproject',
|
||||||
|
stale: false,
|
||||||
|
impressionData: false,
|
||||||
|
archived: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
featureStrategies: [
|
featureStrategies: [
|
||||||
{
|
{
|
||||||
name: 'test',
|
name: 'default',
|
||||||
constraints: [],
|
id: '784f2bc1-ba45-4a92-a6d6-a80e18a4e407',
|
||||||
|
featureName: 'some-toggle1',
|
||||||
|
parameters: {},
|
||||||
|
constraints: [
|
||||||
|
{
|
||||||
|
values: ['ew'],
|
||||||
|
inverted: false,
|
||||||
|
operator: 'IN',
|
||||||
|
contextName: 'appName',
|
||||||
|
caseInsensitive: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
values: ['e'],
|
||||||
|
inverted: false,
|
||||||
|
operator: 'IN',
|
||||||
|
contextName: 'userId',
|
||||||
|
caseInsensitive: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
segments: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
featureEnvironments: [
|
||||||
|
{
|
||||||
|
enabled: true,
|
||||||
|
featureName: 'some-toggle1',
|
||||||
|
environment: 'development',
|
||||||
|
variants: [
|
||||||
|
{
|
||||||
|
name: 'blue',
|
||||||
|
weight: 500,
|
||||||
|
overrides: [
|
||||||
|
{ values: ['best'], contextName: 'appName' },
|
||||||
|
],
|
||||||
|
stickiness: 'default',
|
||||||
|
weightType: 'variable',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'red',
|
||||||
|
weight: 500,
|
||||||
|
payload: { type: 'string', value: 'dsfsd' },
|
||||||
|
overrides: [
|
||||||
|
{ values: ['worst'], contextName: 'appName' },
|
||||||
|
],
|
||||||
|
stickiness: 'default',
|
||||||
|
weightType: 'variable',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
name: 'some-toggle1',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
contextFields: [
|
||||||
|
{
|
||||||
|
name: 'appName',
|
||||||
|
description: 'Allows you to constrain on application name',
|
||||||
|
stickiness: false,
|
||||||
|
sortOrder: 2,
|
||||||
|
legalValues: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'userId',
|
||||||
|
description: 'Allows you to constrain on userId',
|
||||||
|
stickiness: false,
|
||||||
|
sortOrder: 1,
|
||||||
|
legalValues: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
featureTags: [
|
||||||
|
{
|
||||||
|
featureName: 'some-toggle',
|
||||||
|
tagType: 'simple',
|
||||||
|
tagValue: 'best-tag',
|
||||||
|
},
|
||||||
|
{ featureName: 'wat', tagType: 'simple', tagValue: 'best-tag' },
|
||||||
|
{
|
||||||
|
featureName: 'some-toggle1',
|
||||||
|
tagType: 'simple',
|
||||||
|
tagValue: 'best-tag',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
segments: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
|
@ -2,6 +2,7 @@ import { FromSchema } from 'json-schema-to-ts';
|
|||||||
import { constraintSchema } from './constraint-schema';
|
import { constraintSchema } from './constraint-schema';
|
||||||
import { parametersSchema } from './parameters-schema';
|
import { parametersSchema } from './parameters-schema';
|
||||||
import { featureStrategySchema } from './feature-strategy-schema';
|
import { featureStrategySchema } from './feature-strategy-schema';
|
||||||
|
import { variantSchema } from './variant-schema';
|
||||||
|
|
||||||
export const featureEnvironmentSchema = {
|
export const featureEnvironmentSchema = {
|
||||||
$id: '#/components/schemas/featureEnvironmentSchema',
|
$id: '#/components/schemas/featureEnvironmentSchema',
|
||||||
@ -36,12 +37,19 @@ export const featureEnvironmentSchema = {
|
|||||||
$ref: '#/components/schemas/featureStrategySchema',
|
$ref: '#/components/schemas/featureStrategySchema',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
variants: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
$ref: '#/components/schemas/variantSchema',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
schemas: {
|
schemas: {
|
||||||
constraintSchema,
|
constraintSchema,
|
||||||
parametersSchema,
|
parametersSchema,
|
||||||
featureStrategySchema,
|
featureStrategySchema,
|
||||||
|
variantSchema,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -1164,6 +1164,12 @@ exports[`should serve the OpenAPI spec 1`] = `
|
|||||||
"variantCount": {
|
"variantCount": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
},
|
},
|
||||||
|
"variants": {
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/variantSchema",
|
||||||
|
},
|
||||||
|
"type": "array",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"name",
|
"name",
|
||||||
|
Loading…
Reference in New Issue
Block a user