mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-23 02:53:29 +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 {
|
.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 */
|
/* Common Elements */
|
||||||
@@ -746,6 +746,10 @@ body:has(.openapi-select-popover) {
|
|||||||
@apply px-3 transition-all;
|
@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 {
|
.openapi-disclosure-group-trigger[aria-expanded="true"] > .openapi-disclosure-group-icon > svg {
|
||||||
@apply rotate-90;
|
@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]) => ({
|
return Object.entries(response.content ?? {}).map(([contentType, mediaType]) => ({
|
||||||
key: contentType,
|
key: contentType,
|
||||||
label: contentType,
|
label: contentType,
|
||||||
|
|||||||
Reference in New Issue
Block a user