From 77c847d149f629100e56ef2381a35e399d15d7e6 Mon Sep 17 00:00:00 2001 From: Steven Serrata Date: Mon, 16 Dec 2024 16:45:08 -0600 Subject: [PATCH 1/2] handle case where options are combined --- .../src/theme/ApiExplorer/CodeSnippets/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx index c3c9e9b2c..908b1bd0c 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx +++ b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx @@ -54,13 +54,17 @@ function CodeSnippets({ postman, codeSamples }: Props) { const auth = useTypedSelector((state: any) => state.auth); const clonedAuth = cloneDeep(auth); + console.log(clonedAuth); let placeholder: string; function cleanCredentials(obj: any) { for (const key in obj) { if (typeof obj[key] === "object" && obj[key] !== null) { // use name as placeholder if exists - placeholder = clonedAuth?.options?.[key]?.[0]?.name; + const comboAuthId = Object.keys(obj).join(" and "); + const authOptions = + clonedAuth?.options?.[key] ?? clonedAuth?.options?.[comboAuthId]; + placeholder = authOptions?.[0]?.name; obj[key] = cleanCredentials(obj[key]); } else { obj[key] = `<${placeholder ?? key}>`; From e6ce662b64d9c58830b50844f3c87e8b0c8a0ccf Mon Sep 17 00:00:00 2001 From: Steven Serrata Date: Mon, 16 Dec 2024 16:48:07 -0600 Subject: [PATCH 2/2] remove console log --- .../src/theme/ApiExplorer/CodeSnippets/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx index 908b1bd0c..b033e33c6 100644 --- a/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx +++ b/packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx @@ -54,7 +54,6 @@ function CodeSnippets({ postman, codeSamples }: Props) { const auth = useTypedSelector((state: any) => state.auth); const clonedAuth = cloneDeep(auth); - console.log(clonedAuth); let placeholder: string; function cleanCredentials(obj: any) {