From 01484816238a90616fddb4bd0ecc40446db5cc2a Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Thu, 25 Jul 2024 10:36:04 +0300 Subject: [PATCH] feat: update openapi schema for feature creation for tags (#7657) Added tags support for schema. --- .../spec/create-feature-schema.test.ts | 31 +++++++++++++++++++ src/lib/openapi/spec/create-feature-schema.ts | 8 +++++ 2 files changed, 39 insertions(+) create mode 100644 src/lib/openapi/spec/create-feature-schema.test.ts diff --git a/src/lib/openapi/spec/create-feature-schema.test.ts b/src/lib/openapi/spec/create-feature-schema.test.ts new file mode 100644 index 0000000000..665f6ef3e0 --- /dev/null +++ b/src/lib/openapi/spec/create-feature-schema.test.ts @@ -0,0 +1,31 @@ +import { validateSchema } from '../validate'; +import type { CreateFeatureSchema } from './create-feature-schema'; + +test('createFeatureSchema', () => { + const data: CreateFeatureSchema = { + name: 'disable-comments', + type: 'release', + description: + 'Controls disabling of the comments section in case of an incident', + impressionData: false, + tags: ['simple:test', 'simple:test2'], + }; + + expect( + validateSchema('#/components/schemas/createFeatureSchema', data), + ).toBeUndefined(); +}); + +test('createFeatureSchema without tags', () => { + const data: CreateFeatureSchema = { + name: 'disable-comments', + type: 'release', + description: + 'Controls disabling of the comments section in case of an incident', + impressionData: false, + }; + + expect( + validateSchema('#/components/schemas/createFeatureSchema', data), + ).toBeUndefined(); +}); diff --git a/src/lib/openapi/spec/create-feature-schema.ts b/src/lib/openapi/spec/create-feature-schema.ts index 25b85f699d..62e09c98f1 100644 --- a/src/lib/openapi/spec/create-feature-schema.ts +++ b/src/lib/openapi/spec/create-feature-schema.ts @@ -30,6 +30,14 @@ export const createFeatureSchema = { description: '`true` if the impression data collection is enabled for the feature, otherwise `false`.', }, + tags: { + type: 'array', + items: { + type: 'string', + example: 'simple:test', + }, + description: 'List of tags associated with the feature', + }, }, components: {}, } as const;