mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 23:55:20 +00:00
Disable OpenAPI "Try it" when no servers are defined (#3791)
This commit is contained in:
@@ -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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!validateHttpMethod(method)) {
|
if (!validateHttpMethod(method) || (!hasMultipleMediaTypes && servers.length === 0)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ function OpenAPICodeSampleFooter(props: {
|
|||||||
) : (
|
) : (
|
||||||
<span />
|
<span />
|
||||||
)}
|
)}
|
||||||
{!hideTryItPanel && (
|
{!hideTryItPanel && servers.length > 0 && (
|
||||||
<ScalarApiButton
|
<ScalarApiButton
|
||||||
context={getOpenAPIClientContext(context)}
|
context={getOpenAPIClientContext(context)}
|
||||||
method={method}
|
method={method}
|
||||||
|
|||||||
Reference in New Issue
Block a user