We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3876f70 commit b45feafCopy full SHA for b45feaf
.changeset/huge-worms-follow.md
@@ -0,0 +1,5 @@
1
+---
2
+'@gitbook/react-openapi': patch
3
4
+
5
+Disable OpenAPI "Try it" when no servers are defined
packages/react-openapi/src/OpenAPICodeSample.tsx
@@ -220,7 +220,7 @@ function OpenAPICodeSampleFooter(props: {
220
return null;
221
}
222
223
- if (!validateHttpMethod(method)) {
+ if (!validateHttpMethod(method) || (!hasMultipleMediaTypes && servers.length === 0)) {
224
225
226
@@ -237,7 +237,7 @@ function OpenAPICodeSampleFooter(props: {
237
) : (
238
<span />
239
)}
240
- {!hideTryItPanel && (
+ {!hideTryItPanel && servers.length > 0 && (
241
<ScalarApiButton
242
context={getOpenAPIClientContext(context)}
243
method={method}
0 commit comments