From 5992b821803d9cdc45fa0dee100f159dd3ed557f Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Tue, 30 Jul 2024 11:42:49 +0200 Subject: [PATCH] feat(frontend): support array of objects in schema (#4106) * feat(frontend): Support array of objets * feat(frontend): add support for LightweightArgInput * feat(frontend): support objects and arrays of objects in LightweightArgInput --- frontend/src/lib/common.ts | 1 + frontend/src/lib/components/ArgInput.svelte | 23 +++++++++++-- .../lib/components/ArrayTypeNarrowing.svelte | 2 +- .../lib/components/LightweightArgInput.svelte | 34 +++++++++++++++---- frontend/src/lib/inferArgSig.ts | 23 ++++++++++++- frontend/src/lib/utils.ts | 12 ++++++- 6 files changed, 83 insertions(+), 12 deletions(-) diff --git a/frontend/src/lib/common.ts b/frontend/src/lib/common.ts index 64e7fb762f..ba67c7d651 100644 --- a/frontend/src/lib/common.ts +++ b/frontend/src/lib/common.ts @@ -30,6 +30,7 @@ export interface SchemaProperty { contentEncoding?: 'base64' enum?: string[] resourceType?: string + properties?: { [name: string]: SchemaProperty } } min?: number max?: number diff --git a/frontend/src/lib/components/ArgInput.svelte b/frontend/src/lib/components/ArgInput.svelte index 5ad2f95742..c1d390ea8a 100644 --- a/frontend/src/lib/components/ArgInput.svelte +++ b/frontend/src/lib/components/ArgInput.svelte @@ -1,6 +1,11 @@ {#if render} @@ -335,12 +353,19 @@ bind:value={v} resourceType={itemsType?.resourceType} /> + {:else if itemsType?.type === 'object' && itemsType?.properties} +
+ +
{:else} {/if}