From ab82543f54436d135bceb771f07bfc6dbb4151a5 Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Tue, 26 Mar 2024 16:18:35 +0200 Subject: [PATCH] Revert "fix: prevent non-string properties from being passed as context values" (#6702) Reverts Unleash/unleash#6676 --- .../openapi/spec/sdk-context-schema.test.ts | 30 ------------------- src/lib/openapi/spec/sdk-context-schema.ts | 4 +-- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/lib/openapi/spec/sdk-context-schema.test.ts b/src/lib/openapi/spec/sdk-context-schema.test.ts index 79b0cf63d2..38ce31511e 100644 --- a/src/lib/openapi/spec/sdk-context-schema.test.ts +++ b/src/lib/openapi/spec/sdk-context-schema.test.ts @@ -25,33 +25,3 @@ test('sdkContextSchema', () => validateSchema(sdkContextSchema.$id, data) === undefined, ), )); - -test('using objects as values (outside of the `properties` property) is invalid', () => { - const inputs = [ - { - appName: 'test', - array: [], - }, - { - appName: 'test', - object: {}, - }, - { - appName: 'test', - properties: { - array: [], - }, - }, - { - appName: 'test', - properties: { - object: {}, - }, - }, - ]; - - const validationResults = inputs.map((input) => - validateSchema(sdkContextSchema.$id, input), - ); - expect(validationResults.every((error) => error !== undefined)).toBe(true); -}); diff --git a/src/lib/openapi/spec/sdk-context-schema.ts b/src/lib/openapi/spec/sdk-context-schema.ts index 8412333a04..61080b9023 100644 --- a/src/lib/openapi/spec/sdk-context-schema.ts +++ b/src/lib/openapi/spec/sdk-context-schema.ts @@ -5,9 +5,7 @@ export const sdkContextSchema = { description: 'The Unleash context as modeled in client SDKs', type: 'object', required: ['appName'], - additionalProperties: { - type: 'string', - }, + additionalProperties: true, properties: { appName: { type: 'string',