Disable OpenAPI "Try it" when no servers are defined (#3791)

This commit is contained in:
Nolann B.
2025-11-10 17:25:22 +01:00
committed by GitHub
parent 3876f7081e
commit b45feafeff
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@gitbook/react-openapi': patch
---
Disable OpenAPI "Try it" when no servers are defined
@@ -220,7 +220,7 @@ function OpenAPICodeSampleFooter(props: {
return null;
}
if (!validateHttpMethod(method)) {
if (!validateHttpMethod(method) || (!hasMultipleMediaTypes && servers.length === 0)) {
return null;
}
@@ -237,7 +237,7 @@ function OpenAPICodeSampleFooter(props: {
) : (
<span />
)}
{!hideTryItPanel && (
{!hideTryItPanel && servers.length > 0 && (
<ScalarApiButton
context={getOpenAPIClientContext(context)}
method={method}