From 23981407ef1f3e4090c5b36fdb9be262dc315f36 Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Fri, 7 Jul 2023 12:41:48 +0200 Subject: [PATCH] fix: validate min constraint values in openapi (#4179) --- src/lib/openapi/spec/constraint-schema.ts | 1 + src/test/arbitraries.test.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/openapi/spec/constraint-schema.ts b/src/lib/openapi/spec/constraint-schema.ts index 58af9c407d..6cf0d51bec 100644 --- a/src/lib/openapi/spec/constraint-schema.ts +++ b/src/lib/openapi/spec/constraint-schema.ts @@ -39,6 +39,7 @@ export const constraintSchemaBase = { items: { type: 'string', }, + minItems: 1, example: ['my-app', 'my-other-app'], }, value: { diff --git a/src/test/arbitraries.test.ts b/src/test/arbitraries.test.ts index 1d12631a0e..a4c5cd0db8 100644 --- a/src/test/arbitraries.test.ts +++ b/src/test/arbitraries.test.ts @@ -37,7 +37,7 @@ export const strategyConstraint = (): Arbitrary => operator: fc.constantFrom(...ALL_OPERATORS), caseInsensitive: fc.boolean(), inverted: fc.boolean(), - values: fc.array(fc.string()), + values: fc.array(fc.string(), { minLength: 1 }), value: fc.string(), });