Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/huge-worms-follow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@gitbook/react-openapi': patch
---

Disable OpenAPI "Try it" when no servers are defined
4 changes: 2 additions & 2 deletions packages/react-openapi/src/OpenAPICodeSample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function OpenAPICodeSampleFooter(props: {
return null;
}

if (!validateHttpMethod(method)) {
if (!validateHttpMethod(method) || (!hasMultipleMediaTypes && servers.length === 0)) {
return null;
}

Expand All @@ -237,7 +237,7 @@ function OpenAPICodeSampleFooter(props: {
) : (
<span />
)}
{!hideTryItPanel && (
{!hideTryItPanel && servers.length > 0 && (
<ScalarApiButton
context={getOpenAPIClientContext(context)}
method={method}
Expand Down
Loading