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
6 changes: 6 additions & 0 deletions .changeset/fuzzy-ravens-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gitbook/react-openapi": patch
"gitbook": patch
---

OpenAPI: Make responses without objects clickable
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}
Expand Down
14 changes: 14 additions & 0 deletions packages/react-openapi/src/OpenAPIResponses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down