From 4b3bb5f34e58154dabaac8ab372f2e8c278adefa Mon Sep 17 00:00:00 2001 From: Ola Hungerford Date: Wed, 29 Jan 2025 11:36:10 -0700 Subject: [PATCH] Add description to array input fields --- client/src/components/DynamicJsonForm.tsx | 41 +++++++++++++++-------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/client/src/components/DynamicJsonForm.tsx b/client/src/components/DynamicJsonForm.tsx index c1a85d5..66a36fd 100644 --- a/client/src/components/DynamicJsonForm.tsx +++ b/client/src/components/DynamicJsonForm.tsx @@ -132,8 +132,19 @@ const DynamicJsonForm = ({ const arrayValue = Array.isArray(currentValue) ? currentValue : []; if (!propSchema.items) return null; return ( -
- {arrayValue.map((item, index) => ( +
+ {propSchema.description && ( +

{propSchema.description}

+ )} + + {propSchema.items?.description && ( +

+ Items: {propSchema.items.description} +

+ )} + +
+ {arrayValue.map((item, index) => (
{renderFormFields( propSchema.items as JsonSchemaType, @@ -154,18 +165,20 @@ const DynamicJsonForm = ({
))} - + +
); }