Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Revert "fix(docs): show Legacy badge on deprecated API detail pages"

jkomynof3fe143bf779
diff --git a/docs/app/(home)/reference/(v31)/[[...slug]]/page.tsx b/docs/app/(home)/reference/(v31)/[[...slug]]/page.tsx
index 6dba8bbbe..d6713e4e3 100644
--- a/docs/app/(home)/reference/(v31)/[[...slug]]/page.tsx
+++ b/docs/app/(home)/reference/(v31)/[[...slug]]/page.tsx
@@ -12,12 +12,9 @@ import { createRelativeLink } from 'fumadocs-ui/mdx';
import type { ApiPageProps } from 'fumadocs-openapi/ui';
import { PageActions } from '@/components/page-actions';
import { EditOnGitHub } from '@/components/edit-on-github';
-import { extractVersionFromPath } from '@/components/version-badge';
-import { ApiPageTitle } from '@/components/api-page-title';
-import { isApiPageDeprecated } from '@/lib/api-deprecation';
-import type { OpenApiSchemaPageData } from '@/lib/api-deprecation';
+import { VersionBadge, extractVersionFromPath } from '@/components/version-badge';
-interface OpenAPIPageData extends OpenApiSchemaPageData {
+interface OpenAPIPageData {
title: string;
description?: string;
getAPIPageProps: () => ApiPageProps;
@@ -39,15 +36,17 @@ export default async function Page({
const detectedVersion = apiProps.operations?.[0]?.path
? extractVersionFromPath(apiProps.operations[0].path)
: null;
- const deprecated = isApiPageDeprecated(pageData, apiProps.operations);
return (
<DocsPage full footer={{ enabled: false }} tableOfContentPopover={{ enabled: false }}>
<div className="mb-4 flex items-start justify-between gap-4">
- <ApiPageTitle
- title={pageData.title}
- version={detectedVersion}
- deprecated={deprecated}
- />
+ <h1 className="text-2xl font-semibold">
+ {pageData.title}
+ {detectedVersion && (
+ <span className="ml-2 align-middle">
+ <VersionBadge version={detectedVersion} />
+ </span>
+ )}
+ </h1>
<PageActions path={page.url} variant="inline" />
</div>
<DocsBody>
diff --git a/docs/app/(home)/reference/v3/[[...slug]]/page.tsx b/docs/app/(home)/reference/v3/[[...slug]]/page.tsx
index 999c17460..eb1f08c02 100644
--- a/docs/app/(home)/reference/v3/[[...slug]]/page.tsx
+++ b/docs/app/(home)/reference/v3/[[...slug]]/page.tsx
@@ -12,12 +12,9 @@ import { createRelativeLink } from 'fumadocs-ui/mdx';
import type { ApiPageProps } from 'fumadocs-openapi/ui';
import { PageActions } from '@/components/page-actions';
import { EditOnGitHub } from '@/components/edit-on-github';
-import { extractVersionFromPath } from '@/components/version-badge';
-import { ApiPageTitle } from '@/components/api-page-title';
-import { isApiPageDeprecated } from '@/lib/api-deprecation';
-import type { OpenApiSchemaPageData } from '@/lib/api-deprecation';
+import { VersionBadge, extractVersionFromPath } from '@/components/version-badge';
-interface OpenAPIPageData extends OpenApiSchemaPageData {
+interface OpenAPIPageData {
title: string;
description?: string;
getAPIPageProps: () => ApiPageProps;
@@ -47,15 +44,17 @@ export default async function Page({
const detectedVersion = apiProps.operations?.[0]?.path
? extractVersionFromPath(apiProps.operations[0].path)
: null;
- const deprecated = isApiPageDeprecated(pageData, apiProps.operations);
return (
<DocsPage full footer={{ enabled: false }} tableOfContentPopover={{ enabled: false }}>
<div className="mb-4 flex items-start justify-between gap-4">
- <ApiPageTitle
- title={pageData.title}
- version={detectedVersion}
- deprecated={deprecated}
- />
+ <h1 className="text-2xl font-semibold">
+ {pageData.title}
+ {detectedVersion && (
+ <span className="ml-2 align-middle">
+ <VersionBadge version={detectedVersion} />
+ </span>
+ )}
+ </h1>
<PageActions path={page.url} variant="inline" />
</div>
<DocsBody>
diff --git a/docs/components/api-endpoints-table.tsx b/docs/components/api-endpoints-table.tsx
index a36d5964a..c2553babf 100644
--- a/docs/components/api-endpoints-table.tsx
+++ b/docs/components/api-endpoints-table.tsx
@@ -1,7 +1,7 @@
'use client';
import { useApiVersion } from '@/lib/use-api-version';
-import { DeprecatedApiLegacyBadge } from '@/components/legacy-badge';
+import { LegacyBadge } from '@/components/legacy-badge';
interface Endpoint {
method: string;
@@ -39,7 +39,9 @@ export function ApiEndpointsTable({ endpoints }: { endpoints: Endpoint[] }) {
<a href={ep.href}>{ep.summary}</a>
{ep.legacy && (
<span className="ml-2 inline-flex align-middle">
- <DeprecatedApiLegacyBadge />
+ <LegacyBadge
+ title="Deprecated API endpoint; kept for existing integrations and may be removed in a future release"
+ />
</span>
)}
</td>
diff --git a/docs/components/api-page-title.tsx b/docs/components/api-page-title.tsx
deleted file mode 100644
index 618c7f636..000000000
--- a/docs/components/api-page-title.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { DeprecatedApiLegacyBadge } from '@/components/legacy-badge';
-import { VersionBadge } from '@/components/version-badge';
-
-interface ApiPageTitleProps {
- title: string;
- version: string | null;
- deprecated: boolean;
-}
-
-export function ApiPageTitle({
- title,
- version,
- deprecated,
-}: ApiPageTitleProps) {
- return (
- <h1 className="text-2xl font-semibold">
- {title}
- {version && (
- <span className="ml-2 align-middle">
- <VersionBadge version={version} />
- </span>
- )}
- {deprecated && (
- <span className="ml-2 inline-flex align-middle">
- <DeprecatedApiLegacyBadge />
- </span>
- )}
- </h1>
- );
-}
diff --git a/docs/components/legacy-badge.tsx b/docs/components/legacy-badge.tsx
index 3bb4c6bd6..40b31c253 100644
--- a/docs/components/legacy-badge.tsx
+++ b/docs/components/legacy-badge.tsx
@@ -9,9 +9,6 @@ interface LegacyBadgeProps {
title?: string;
}
-export const DEPRECATED_API_LEGACY_TITLE =
- 'Deprecated API endpoint; kept for existing integrations and may be removed in a future release';
-
export function LegacyBadge({
title = 'Legacy: superseded by sessions; kept for existing integrations',
}: LegacyBadgeProps) {
@@ -24,7 +21,3 @@ export function LegacyBadge({
</span>
);
}
-
-export function DeprecatedApiLegacyBadge() {
- return <LegacyBadge title={DEPRECATED_API_LEGACY_TITLE} />;
-}
diff --git a/docs/lib/api-deprecation.ts b/docs/lib/api-deprecation.ts
deleted file mode 100644
index dbaa322e0..000000000
--- a/docs/lib/api-deprecation.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-interface ApiPageOperation {
- method: string;
- path: string;
-}
-
-export interface OpenApiSchemaPageData {
- getSchema: () => {
- dereferenced: {
- paths?: Record<
- string,
- Record<string, { deprecated?: boolean } | undefined> | undefined
- >;
- };
- };
-}
-
-/**
- * Returns whether any operation rendered by an OpenAPI page is deprecated.
- * Operation detail pages currently contain one operation, but checking all of
- * them keeps the helper correct for grouped pages too.
- */
-export function isApiPageDeprecated(
- pageData: OpenApiSchemaPageData,
- operations?: ApiPageOperation[],
-): boolean {
- if (!operations || operations.length === 0) return false;
-
- const paths = pageData.getSchema().dereferenced.paths;
- return operations.some(
- ({ method, path }) => paths?.[path]?.[method]?.deprecated === true,
- );
-}
diff --git a/docs/tests/integration/rendering.test.ts b/docs/tests/integration/rendering.test.ts
index d704ab3d0..8f5f0fc12 100644
--- a/docs/tests/integration/rendering.test.ts
+++ b/docs/tests/integration/rendering.test.ts
@@ -19,21 +19,6 @@ const CRITICAL_PAGES = [
{ path: "/reference", name: "Reference index" },
];
-const DEPRECATED_API_LEGACY_TITLE =
- "Deprecated API endpoint; kept for existing integrations and may be removed in a future release";
-
-const DEPRECATED_API_PAGES = [
- "/reference/api-reference/connected-accounts/postConnectedAccountsByNanoidRefresh",
- "/reference/api-reference/files/getFilesList",
- "/reference/v3/api-reference/connected-accounts/postConnectedAccountsByNanoidRefresh",
- "/reference/v3/api-reference/files/getFilesList",
-];
-
-const ACTIVE_API_PAGES = [
- "/reference/api-reference/files/postFilesUploadRequest",
- "/reference/v3/api-reference/files/postFilesUploadRequest",
-];
-
describe("Page rendering - critical pages", () => {
for (const { path, name } of CRITICAL_PAGES) {
test(`${name} (${path}) returns 200`, async () => {
@@ -71,28 +56,6 @@ describe("Page rendering - content markers", () => {
});
});
-describe("Page rendering - deprecated API endpoints", () => {
- for (const path of DEPRECATED_API_PAGES) {
- test(`${path} renders the Legacy badge`, async () => {
- const res = await fetchPage(path);
- const html = await res.text();
-
- expect(res.status).toBe(200);
- expect(html).toContain(DEPRECATED_API_LEGACY_TITLE);
- });
- }
-
- for (const path of ACTIVE_API_PAGES) {
- test(`${path} omits the Legacy badge`, async () => {
- const res = await fetchPage(path);
- const html = await res.text();
-
- expect(res.status).toBe(200);
- expect(html).not.toContain(DEPRECATED_API_LEGACY_TITLE);
- });
- }
-});
-
describe("Page rendering - error handling", () => {
test("non-existent page returns 404", async () => {
const res = await fetchPage("/docs/this-page-does-not-exist-ever");
diff --git a/docs/tests/static/api-deprecation.test.tsx b/docs/tests/static/api-deprecation.test.tsx
index bcb1c3aa0..e45e35e3d 100644
--- a/docs/tests/static/api-deprecation.test.tsx
+++ b/docs/tests/static/api-deprecation.test.tsx
@@ -9,8 +9,6 @@ mock.module("next/navigation", () => ({
}));
const { ApiEndpointsTable } = await import("../../components/api-endpoints-table");
-const { ApiPageTitle } = await import("../../components/api-page-title");
-const { isApiPageDeprecated } = await import("../../lib/api-deprecation");
const DOCS_DIR = join(import.meta.dir, "../..");
const GENERATOR_PATH = join(DOCS_DIR, "scripts/generate-api-index.ts");
@@ -117,69 +115,6 @@ afterEach(async () => {
});
describe("deprecated API endpoints", () => {
- test("renders Legacy on a deprecated API endpoint detail title", () => {
- const operation = {
- method: "get",
- path: "/v3.1/tasks/deprecated",
- };
- const pageData = {
- getSchema: () => ({
- dereferenced: {
- paths: {
- [operation.path]: {
- [operation.method]: { deprecated: true },
- },
- },
- },
- }),
- };
-
- const deprecated = isApiPageDeprecated(pageData, [operation]);
- const html = renderToStaticMarkup(
- <ApiPageTitle
- title="Deprecated task endpoint"
- version="3.1"
- deprecated={deprecated}
- />,
- );
-
- expect(deprecated).toBe(true);
- expect(html.match(/>Legacy<\/span>/g)).toHaveLength(1);
- expect(html).toContain(
- 'title="Deprecated API endpoint; kept for existing integrations and may be removed in a future release"',
- );
- });
-
- test("omits Legacy from an active API endpoint detail title", () => {
- const operation = {
- method: "post",
- path: "/v3.1/tasks/active",
- };
- const pageData = {
- getSchema: () => ({
- dereferenced: {
- paths: {
- [operation.path]: {
- [operation.method]: {},
- },
- },
- },
- }),
- };
-
- const deprecated = isApiPageDeprecated(pageData, [operation]);
- const html = renderToStaticMarkup(
- <ApiPageTitle
- title="Active task endpoint"
- version="3.1"
- deprecated={deprecated}
- />,
- );
-
- expect(deprecated).toBe(false);
- expect(html).not.toContain(">Legacy</span>");
- });
-
test("serializes legacy only for deprecated v3.1 and v3 operations", async () => {
const fixtureDir = await generateFixture();
const v31Content = await readFile(