mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +00:00
OpenAPI: Make empty responses clickable (#3605)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@gitbook/react-openapi": patch
|
||||
"gitbook": patch
|
||||
---
|
||||
|
||||
OpenAPI: Make responses without objects clickable
|
||||
@@ -565,7 +565,7 @@
|
||||
}
|
||||
|
||||
.openapi-example-empty {
|
||||
@apply relative text-tint bg-tint min-h-20 flex flex-col justify-center items-center;
|
||||
@apply relative text-tint min-h-20 flex flex-col justify-center items-center text-sm;
|
||||
}
|
||||
|
||||
/* Common Elements */
|
||||
@@ -746,6 +746,10 @@ body:has(.openapi-select-popover) {
|
||||
@apply px-3 transition-all;
|
||||
}
|
||||
|
||||
.openapi-disclosure-group-trigger[aria-expanded="true"] > .openapi-disclosure-group-label {
|
||||
@apply font-medium;
|
||||
}
|
||||
|
||||
.openapi-disclosure-group-trigger[aria-expanded="true"] > .openapi-disclosure-group-icon > svg {
|
||||
@apply rotate-90;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,20 @@ export function OpenAPIResponses(props: {
|
||||
];
|
||||
}
|
||||
|
||||
if (!response.content) {
|
||||
return [
|
||||
{
|
||||
key: 'default',
|
||||
label: '',
|
||||
body: (
|
||||
<pre className="openapi-example-empty">
|
||||
<p>{t(context.translation, 'no_content')}</p>
|
||||
</pre>
|
||||
),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return Object.entries(response.content ?? {}).map(([contentType, mediaType]) => ({
|
||||
key: contentType,
|
||||
label: contentType,
|
||||
|
||||
Reference in New Issue
Block a user