diff --git a/packages/gitbook/src/components/DocumentView/OpenAPI/context.tsx b/packages/gitbook/src/components/DocumentView/OpenAPI/context.tsx
index 90b3be5e2..c25d369fd 100644
--- a/packages/gitbook/src/components/DocumentView/OpenAPI/context.tsx
+++ b/packages/gitbook/src/components/DocumentView/OpenAPI/context.tsx
@@ -83,5 +83,9 @@ export function getOpenAPIContext(args: {
id: block.meta?.id,
blockKey: block.key,
locale,
+ hideSummaryAndDescription:
+ 'hideSummaryAndDescription' in block.data
+ ? Boolean(block.data.hideSummaryAndDescription)
+ : false,
};
}
diff --git a/packages/gitbook/src/components/DocumentView/OpenAPI/style.css b/packages/gitbook/src/components/DocumentView/OpenAPI/style.css
index 5fac6a4f3..6cfe00b7f 100644
--- a/packages/gitbook/src/components/DocumentView/OpenAPI/style.css
+++ b/packages/gitbook/src/components/DocumentView/OpenAPI/style.css
@@ -124,7 +124,8 @@
.openapi-method-head,
.openapi-method-options,
-.openapi-method-trace {
+.openapi-method-trace,
+.openapi-method-hook {
@apply bg-tint;
}
@@ -1011,4 +1012,8 @@ body:has(.openapi-select-popover) {
.openapi-path-copy-button-icon svg {
@apply text-tint size-4;
+}
+
+.openapi-operation-no-summary .openapi-column-preview {
+ @apply pt-0;
}
\ No newline at end of file
diff --git a/packages/gitbook/src/components/PageBody/PageHeader.tsx b/packages/gitbook/src/components/PageBody/PageHeader.tsx
index 66d483a9b..c7a7ec6db 100644
--- a/packages/gitbook/src/components/PageBody/PageHeader.tsx
+++ b/packages/gitbook/src/components/PageBody/PageHeader.tsx
@@ -113,6 +113,7 @@ export async function PageHeader(props: {
>
{page.title}
+ {'computed' in page && page.computed?.props.deprecated ? Deprecated : null}
) : null}
{page.description && page.layout.description ? (
diff --git a/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx b/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx
index 13b398887..2d67b8439 100644
--- a/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx
+++ b/packages/gitbook/src/components/TableOfContents/PageDocumentItem.tsx
@@ -38,15 +38,38 @@ export function PageDocumentItem(props: { page: ClientTOCPageDocument }) {
) : null
}
>
- {page.emoji || page.icon ? (
+ {page.computed?.props.method ? (
+
+
+ {page.title}
+
+ ) : page.emoji || page.icon ? (
{page.title}
- ) : (
- page.title
- )}
+ ) : page.title}
);
}
+
+const MethodTag = ({ method }: { method: string }) => {
+
+ const formattedMethod = (() => {
+ switch (method) {
+ case 'delete':
+ return 'DEL';
+ case 'options':
+ return 'OPT';
+ default:
+ return method;
+ }
+ })();
+
+ return (
+
+ {formattedMethod}
+
+ );
+};
diff --git a/packages/gitbook/src/components/TableOfContents/encodeClientTableOfContents.ts b/packages/gitbook/src/components/TableOfContents/encodeClientTableOfContents.ts
index 3c3820c3f..ae1006a35 100644
--- a/packages/gitbook/src/components/TableOfContents/encodeClientTableOfContents.ts
+++ b/packages/gitbook/src/components/TableOfContents/encodeClientTableOfContents.ts
@@ -2,7 +2,7 @@ import type { GitBookSiteContext } from '@/lib/context';
import { getPagePaths, hasPageVisibleDescendant } from '@/lib/pages';
import { resolveContentRef } from '@/lib/references';
import { removeUndefined } from '@/lib/typescript';
-import type { ContentRef, RevisionPage } from '@gitbook/api';
+import type { ComputedContentSource, ContentRef, RevisionPage } from '@gitbook/api';
import assertNever from 'assert-never';
export type ClientTOCPageLink = {
@@ -24,6 +24,7 @@ export type ClientTOCPageDocument = {
icon?: string;
pathnames: string[];
descendants?: ClientTOCPage[];
+ computed?: ComputedContentSource
};
export type ClientTOCPageGroup = {
@@ -79,6 +80,7 @@ export async function encodeClientTableOfContents(
pathnames: getPagePaths(rootPages, page),
descendants,
type: 'document',
+ computed: 'computed' in page && page.computed ? page.computed : undefined,
})
);
break;
diff --git a/packages/react-openapi/src/OpenAPIOperation.tsx b/packages/react-openapi/src/OpenAPIOperation.tsx
index e3fdbac98..a0c1995da 100644
--- a/packages/react-openapi/src/OpenAPIOperation.tsx
+++ b/packages/react-openapi/src/OpenAPIOperation.tsx
@@ -19,7 +19,13 @@ export function OpenAPIOperation(props: {
const context = resolveOpenAPIContext(contextInput);
return (
-
+
diff --git a/packages/react-openapi/src/common/OpenAPIColumnSpec.tsx b/packages/react-openapi/src/common/OpenAPIColumnSpec.tsx
index 59eb8d539..4fafa2ea1 100644
--- a/packages/react-openapi/src/common/OpenAPIColumnSpec.tsx
+++ b/packages/react-openapi/src/common/OpenAPIColumnSpec.tsx
@@ -24,7 +24,7 @@ export function OpenAPIColumnSpec(props: {
])}
) : null}
-
+ {!context.hideSummaryAndDescription ?
: null}
);
diff --git a/packages/react-openapi/src/common/OpenAPISummary.tsx b/packages/react-openapi/src/common/OpenAPISummary.tsx
index 8c81ae2b4..0a0c0a4ca 100644
--- a/packages/react-openapi/src/common/OpenAPISummary.tsx
+++ b/packages/react-openapi/src/common/OpenAPISummary.tsx
@@ -24,15 +24,18 @@ export function OpenAPISummary(props: {
return (
- {(operation.deprecated || operation['x-stability']) && (
+ {(operation.deprecated && !context.hideSummaryAndDescription) ||
+ operation['x-stability'] ? (
- {operation.deprecated &&
Deprecated
}
+ {operation.deprecated && !context.hideSummaryAndDescription && (
+
Deprecated
+ )}
{operation['x-stability'] && (
)}
- )}
- {title
+ ) : null}
+ {title && !context.hideSummaryAndDescription
? context.renderHeading({
deprecated: operation.deprecated ?? false,
stability: operation['x-stability'],
diff --git a/packages/react-openapi/src/context.ts b/packages/react-openapi/src/context.ts
index 76a6293ab..77b569f7e 100644
--- a/packages/react-openapi/src/context.ts
+++ b/packages/react-openapi/src/context.ts
@@ -63,6 +63,12 @@ export interface OpenAPIContext extends Omit