From 58b75cd53d2255848762991daed3b05fde04a33c Mon Sep 17 00:00:00 2001 From: Nolann Biron Date: Fri, 3 Oct 2025 12:43:44 +0200 Subject: [PATCH 1/2] Fix OpenAPI alternatives not showing --- .changeset/unlucky-pumpkins-yawn.md | 6 ++++++ .../components/DocumentView/OpenAPI/style.css | 2 +- packages/react-openapi/src/OpenAPISchema.tsx | 20 +++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 .changeset/unlucky-pumpkins-yawn.md diff --git a/.changeset/unlucky-pumpkins-yawn.md b/.changeset/unlucky-pumpkins-yawn.md new file mode 100644 index 0000000000..8432e572a9 --- /dev/null +++ b/.changeset/unlucky-pumpkins-yawn.md @@ -0,0 +1,6 @@ +--- +"@gitbook/react-openapi": patch +"gitbook": patch +--- + +Fix OpenAPI alternatives not showing diff --git a/packages/gitbook/src/components/DocumentView/OpenAPI/style.css b/packages/gitbook/src/components/DocumentView/OpenAPI/style.css index 2642f2fb1f..3148106942 100644 --- a/packages/gitbook/src/components/DocumentView/OpenAPI/style.css +++ b/packages/gitbook/src/components/DocumentView/OpenAPI/style.css @@ -840,7 +840,7 @@ body:has(.openapi-select-popover) { } .openapi-disclosure-trigger-label { - @apply absolute right-3 px-2 h-5 justify-end shrink-0 ring-tint-subtle truncate text-tint duration-300 transition-all rounded straight-corners:rounded-none circular-corners:rounded-xl flex flex-row gap-1 items-center text-xs; + @apply absolute right-[calc(0.75rem+1px)] px-2 h-5 justify-end shrink-0 ring-tint-subtle truncate text-tint duration-300 transition-all rounded straight-corners:rounded-none circular-corners:rounded-xl flex flex-row gap-1 items-center text-xs; } .openapi-disclosure-trigger-label span { diff --git a/packages/react-openapi/src/OpenAPISchema.tsx b/packages/react-openapi/src/OpenAPISchema.tsx index 56f55d236b..eaa5fe7ad3 100644 --- a/packages/react-openapi/src/OpenAPISchema.tsx +++ b/packages/react-openapi/src/OpenAPISchema.tsx @@ -60,16 +60,6 @@ function OpenAPISchemaProperty( const header = ; const content = (() => { - if (properties?.length) { - return ( - - ); - } - if (alternatives?.schemas) { const { schemas, discriminator } = alternatives; return ( @@ -94,6 +84,16 @@ function OpenAPISchemaProperty( ); } + if (properties?.length) { + return ( + + ); + } + return null; })(); From 23e26ac1c38a54c04c24941c8706105a915df84b Mon Sep 17 00:00:00 2001 From: Nolann Biron Date: Fri, 3 Oct 2025 12:52:47 +0200 Subject: [PATCH 2/2] fix spacing --- packages/gitbook/src/components/DocumentView/OpenAPI/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gitbook/src/components/DocumentView/OpenAPI/style.css b/packages/gitbook/src/components/DocumentView/OpenAPI/style.css index 3148106942..1d26b03867 100644 --- a/packages/gitbook/src/components/DocumentView/OpenAPI/style.css +++ b/packages/gitbook/src/components/DocumentView/OpenAPI/style.css @@ -840,7 +840,7 @@ body:has(.openapi-select-popover) { } .openapi-disclosure-trigger-label { - @apply absolute right-[calc(0.75rem+1px)] px-2 h-5 justify-end shrink-0 ring-tint-subtle truncate text-tint duration-300 transition-all rounded straight-corners:rounded-none circular-corners:rounded-xl flex flex-row gap-1 items-center text-xs; + @apply absolute right-3 mr-px px-2 h-5 justify-end shrink-0 ring-tint-subtle truncate text-tint duration-300 transition-all rounded straight-corners:rounded-none circular-corners:rounded-xl flex flex-row gap-1 items-center text-xs; } .openapi-disclosure-trigger-label span {