From 7c69500cd01065bcdd008f936c4d809878bf919e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Fournier?= Date: Thu, 14 Mar 2024 13:59:20 +0100 Subject: [PATCH] chore: mark resource limits config type fields mandatory (#6550) ## About the changes All fields should be defined in the configuration to either a user-provided value or a sensible default --- .../openapi/spec/resource-limits-schema.ts | 26 +++++++++++++------ src/lib/openapi/spec/ui-config-schema.ts | 9 +++++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/lib/openapi/spec/resource-limits-schema.ts b/src/lib/openapi/spec/resource-limits-schema.ts index fdb52e2cbd..6a678245b2 100644 --- a/src/lib/openapi/spec/resource-limits-schema.ts +++ b/src/lib/openapi/spec/resource-limits-schema.ts @@ -4,49 +4,59 @@ export const resourceLimitsSchema = { $id: '#/components/schemas/resourceLimitsSchema', type: 'object', description: 'A map of resource names and their limits.', + required: [ + 'segmentValues', + 'strategySegments', + 'actionSetActions', + 'actionSetsPerProject', + 'actionSetFilters', + 'actionSetFilterValues', + 'signalEndpoints', + 'signalTokensPerEndpoint', + ], additionalProperties: false, properties: { segmentValues: { - type: 'number', + type: 'integer', example: 10, description: 'The maximum number of values per segment allowed.', }, strategySegments: { - type: 'number', + type: 'integer', example: 10, description: 'The maximum number of strategy segments allowed.', }, actionSetActions: { - type: 'number', + type: 'integer', example: 10, description: 'The maximum number of actions per action set allowed.', }, actionSetsPerProject: { - type: 'number', + type: 'integer', example: 10, description: 'The maximum number of action set definitions per project allowed.', }, actionSetFilters: { - type: 'number', + type: 'integer', example: 10, description: 'The maximum number of filters per action set allowed.', }, actionSetFilterValues: { - type: 'number', + type: 'integer', example: 10, description: 'The maximum number of filter values inside an action set allowed.', }, signalEndpoints: { - type: 'number', + type: 'integer', example: 10, description: 'The maximum number of signal endpoints allowed.', }, signalTokensPerEndpoint: { - type: 'number', + type: 'integer', example: 10, description: 'The maximum number of signal tokens per endpoint allowed.', diff --git a/src/lib/openapi/spec/ui-config-schema.ts b/src/lib/openapi/spec/ui-config-schema.ts index 944a9f6ed8..06a22af378 100644 --- a/src/lib/openapi/spec/ui-config-schema.ts +++ b/src/lib/openapi/spec/ui-config-schema.ts @@ -84,8 +84,13 @@ export const uiConfigSchema = { $ref: resourceLimitsSchema.$id, description: resourceLimitsSchema.description, example: { - segmentValues: 100, - strategySegments: 5, + ...Object.entries(resourceLimitsSchema.properties).reduce( + (acc, [prop, { example }]) => ({ + ...acc, + [prop]: example, + }), + {}, + ), }, }, networkViewEnabled: {