From b4526d0a65ce4da72625f98ec11fa7e891e5b243 Mon Sep 17 00:00:00 2001 From: zorox112 Date: Tue, 15 Oct 2024 23:34:17 +0300 Subject: [PATCH] fix: Fix complex descriptions (with constraints) --- src/includer/traverse/description.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/includer/traverse/description.ts b/src/includer/traverse/description.ts index f8c9de0..d22a056 100644 --- a/src/includer/traverse/description.ts +++ b/src/includer/traverse/description.ts @@ -39,10 +39,11 @@ const fields: Fields = [ key: 'pattern', label: 'Pattern', }, - { + (value) => ({ key: 'uniqueItems', label: 'Unique items', - }, + computed: String(value.uniqueItems), + }), (value) => { return { key: 'minimum', @@ -75,7 +76,7 @@ function prepareComplexDescription(baseDescription: string, value: OpenJSONSchem return fields.reduce((acc, curr) => { const field = typeof curr === 'function' ? curr(value) : curr; - if (typeof field === 'undefined' || !value[field.key]) { + if (typeof field === 'undefined' || typeof value[field.key] === 'undefined') { return acc; }