1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

fix: add missing client variant schema fields (#1880)

* refactor: format file

* fix: use correct variants schema reference

* fix: add missing client variant schema fields
This commit is contained in:
olav 2022-08-02 13:06:10 +02:00 committed by GitHub
parent d922ea1225
commit 666ca1935c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 363 additions and 332 deletions

View File

@ -16,6 +16,14 @@ test('clientFeaturesSchema required fields', () => {
name: 'some-name',
enabled: false,
impressionData: false,
variants: [
{
name: 'a',
weight: 1,
weightType: 'b',
stickiness: 'c',
},
],
},
],
};
@ -101,7 +109,6 @@ test('clientFeaturesSchema java-sdk expected response', () => {
}
}
]
},
{
"name": "featureZ",
@ -115,14 +122,14 @@ test('clientFeaturesSchema java-sdk expected response', () => {
"parameters": {
"name": "val"
},
"segments": [1]
}
"segments": [
1
]
}
]
}
`;
]
}`;
expect(
validateSchema(
@ -208,7 +215,6 @@ test('clientFeaturesSchema unleash-proxy expected response', () => {
}
}
]
},
{
"name": "featureZ",
@ -222,14 +228,14 @@ test('clientFeaturesSchema unleash-proxy expected response', () => {
"parameters": {
"name": "val"
},
"segments": [1]
}
"segments": [
1
]
}
]
}
`;
]
}`;
expect(
validateSchema(
@ -251,7 +257,9 @@ test('clientFeaturesSchema client specification test 15', () => {
{
"name": "default",
"parameters": {},
"segments": [1]
"segments": [
1
]
}
]
},
@ -263,7 +271,9 @@ test('clientFeaturesSchema client specification test 15', () => {
{
"name": "default",
"parameters": {},
"segments": [2]
"segments": [
2
]
}
]
},
@ -282,7 +292,9 @@ test('clientFeaturesSchema client specification test 15', () => {
"value": "1.2.2"
}
],
"segments": [1]
"segments": [
1
]
}
]
},
@ -302,7 +314,9 @@ test('clientFeaturesSchema client specification test 15', () => {
"value": "1.2.2"
}
],
"segments": [3]
"segments": [
3
]
}
]
},
@ -326,7 +340,11 @@ test('clientFeaturesSchema client specification test 15', () => {
"value": "3.2.2"
}
],
"segments": [1, 4, 5]
"segments": [
1,
4,
5
]
}
]
}
@ -368,7 +386,9 @@ test('clientFeaturesSchema client specification test 15', () => {
{
"contextName": "customName",
"operator": "STR_CONTAINS",
"values": ["Pi"]
"values": [
"Pi"
]
}
]
},
@ -383,8 +403,7 @@ test('clientFeaturesSchema client specification test 15', () => {
]
}
]
}
`;
}`;
expect(
validateSchema(

View File

@ -6,8 +6,8 @@ import { environmentSchema } from './environment-schema';
import { overrideSchema } from './override-schema';
import { parametersSchema } from './parameters-schema';
import { featureStrategySchema } from './feature-strategy-schema';
import { variantSchema } from './variant-schema';
import { clientFeatureSchema } from './client-feature-schema';
import { clientVariantSchema } from './client-variant-schema';
export const clientFeaturesSchema = {
$id: '#/components/schemas/clientFeaturesSchema',
@ -43,7 +43,7 @@ export const clientFeaturesSchema = {
overrideSchema,
parametersSchema,
featureStrategySchema,
variantSchema,
clientVariantSchema,
},
},
} as const;

View File

@ -12,6 +12,12 @@ export const clientVariantSchema = {
weight: {
type: 'number',
},
weightType: {
type: 'string',
},
stickiness: {
type: 'string',
},
payload: {
type: 'object',
required: ['type', 'value'],

View File

@ -660,9 +660,15 @@ Object {
],
"type": "object",
},
"stickiness": Object {
"type": "string",
},
"weight": Object {
"type": "number",
},
"weightType": Object {
"type": "string",
},
},
"required": Array [
"name",