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..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-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-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 { 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; })();