From 267c3fe87fe94b59fc97894f603514985400645d Mon Sep 17 00:00:00 2001 From: Ewan Harris Date: Mon, 29 Apr 2024 14:39:58 +0100 Subject: [PATCH] fix(snippets/js): correct casing for contextual tuples in check and list objects (#726) Co-authored-by: Raghd Hamzeh --- src/components/Docs/SnippetViewer/CheckRequestViewer.tsx | 2 +- src/components/Docs/SnippetViewer/ListObjectsRequestViewer.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Docs/SnippetViewer/CheckRequestViewer.tsx b/src/components/Docs/SnippetViewer/CheckRequestViewer.tsx index d02e1b2e8..ae42a6c65 100644 --- a/src/components/Docs/SnippetViewer/CheckRequestViewer.tsx +++ b/src/components/Docs/SnippetViewer/CheckRequestViewer.tsx @@ -70,7 +70,7 @@ const { allowed } = await fgaClient.check({ !contextualTuples ? `` : ` - contextual_tuples: [\n ${contextualTuples.map((tuple) => `${JSON.stringify(tuple)}`).join(',')} + contextualTuples: [\n ${contextualTuples.map((tuple) => `${JSON.stringify(tuple)}`).join(',')} ],` }${!context ? `\n }` : `\n context: ${JSON.stringify(context)}\n }`}, { authorization_model_id: '${modelId}', diff --git a/src/components/Docs/SnippetViewer/ListObjectsRequestViewer.tsx b/src/components/Docs/SnippetViewer/ListObjectsRequestViewer.tsx index f76cec4aa..7ce197155 100644 --- a/src/components/Docs/SnippetViewer/ListObjectsRequestViewer.tsx +++ b/src/components/Docs/SnippetViewer/ListObjectsRequestViewer.tsx @@ -74,7 +74,7 @@ function listObjectsRequestViewer(lang: SupportedLanguage, opts: ListObjectsRequ type: "${objectType}",${ contextualTuples?.length ? ` - contextual_tuples: { + contextualTuples: { tuple_keys: [${contextualTuples .map( (tupleKey) => `{