mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +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:
		
							parent
							
								
									2d22a4d471
								
							
						
					
					
						commit
						9c491c0abc
					
				@ -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(
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,12 @@ export const clientVariantSchema = {
 | 
			
		||||
        weight: {
 | 
			
		||||
            type: 'number',
 | 
			
		||||
        },
 | 
			
		||||
        weightType: {
 | 
			
		||||
            type: 'string',
 | 
			
		||||
        },
 | 
			
		||||
        stickiness: {
 | 
			
		||||
            type: 'string',
 | 
			
		||||
        },
 | 
			
		||||
        payload: {
 | 
			
		||||
            type: 'object',
 | 
			
		||||
            required: ['type', 'value'],
 | 
			
		||||
 | 
			
		||||
@ -660,9 +660,15 @@ Object {
 | 
			
		||||
            ],
 | 
			
		||||
            "type": "object",
 | 
			
		||||
          },
 | 
			
		||||
          "stickiness": Object {
 | 
			
		||||
            "type": "string",
 | 
			
		||||
          },
 | 
			
		||||
          "weight": Object {
 | 
			
		||||
            "type": "number",
 | 
			
		||||
          },
 | 
			
		||||
          "weightType": Object {
 | 
			
		||||
            "type": "string",
 | 
			
		||||
          },
 | 
			
		||||
        },
 | 
			
		||||
        "required": Array [
 | 
			
		||||
          "name",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user