@devries-cameron20 / composio-1 / commits / b9a790ef4
Fork 0

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

docs: tag deprecated API endpoints with the existing Legacy tag (#3838)

## Summary Deprecated REST endpoints now surface the existing `Legacy` badge in generated API-reference indexes, with endpoint-specific tooltip copy instead of the Sessions-specific default. The generator behavior is covered end to end for both v3 and v3.1, including rendered table output. This branch also restores CI compatibility with the organization Actions policy: workflow tool versions still come from `mise.toml`, but installation uses the approved, SHA-pinned setup actions. Secret scanning pins the repaired organization reusable workflow from ComposioHQ/.github#13. ## Changes - Read the OpenAPI `deprecated` flag and emit `legacy: true` only for deprecated operations. - Render `LegacyBadge` on affected endpoint rows with accurate lifecycle tooltip copy. - Regenerate the affected `files` and `connected-accounts` indexes for v3 and v3.1. - Cover the real generator output, active-operation omission, badge count, and tooltip through a focused regression test. - Replace disallowed transitive Actions dependencies while retaining `mise.toml` as the single tool-version source. Endpoint detail pages continue to use `fumadocs-openapi`'s built-in deprecated marker. The indexed endpoints are `GET /files/list` and `POST /connected_accounts/{nanoid}/refresh`; internal operations remain filtered from the docs. ## Spec data The committed OpenAPI snapshots lagged the live backend for `POST /connected_accounts/{nanoid}/refresh`. Both snapshots now carry its current summary, description, and `deprecated: true`; the next `fetch-openapi.mjs` run will preserve that state from the live spec. ## Validation - `bun run test`: 25 passed, 0 failed. - `bun run types:check`: passed. - Focused ESLint and generated-index drift checks: clean. - Composite-action and workflow YAML parsed successfully; extracted tool pins match `mise.toml`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: jkomyno <alberto@composio.dev>

Lingala committed Jul 15, 2026 at 19:16 UTC b9a790ef4eb74f6a4f950923d0ea9ae2eeeffc97
10 files changed +215 -11
docs/components/api-endpoints-table.tsx
+14 -1
@@ -1,6 +1,7 @@
1 'use client';
2
3 import { useApiVersion } from '@/lib/use-api-version';
4 +import { LegacyBadge } from '@/components/legacy-badge';
5
6 interface Endpoint {
7 method: string;
@@ -8,6 +9,9 @@ interface Endpoint {
9 pathV3: string;
10 summary: string;
11 href: string;
12 + /** Set by the generator for operations flagged `deprecated` in the OpenAPI
13 + * spec. Surfaced with the existing "Legacy" tag (see components/legacy-badge.tsx). */
14 + legacy?: boolean;
15 }
16
17 /**
@@ -31,7 +35,16 @@ export function ApiEndpointsTable({ endpoints }: { endpoints: Endpoint[] }) {
35 return (
36 <tr key={i}>
37 <td><code>{ep.method} {path}</code></td>
34 - <td><a href={ep.href}>{ep.summary}</a></td>
38 + <td>
39 + <a href={ep.href}>{ep.summary}</a>
40 + {ep.legacy && (
41 + <span className="ml-2 inline-flex align-middle">
42 + <LegacyBadge
43 + title="Deprecated API endpoint; kept for existing integrations and may be removed in a future release"
44 + />
45 + </span>
46 + )}
47 + </td>
48 </tr>
49 );
50 })}
docs/components/legacy-badge.tsx
+8 -2
@@ -5,10 +5,16 @@
5 * the `written` frontmatter field), so a current, dated guide can show its date
6 * without being marked legacy.
7 */
8 -export function LegacyBadge() {
8 +interface LegacyBadgeProps {
9 + title?: string;
10 +}
11 +
12 +export function LegacyBadge({
13 + title = 'Legacy: superseded by sessions; kept for existing integrations',
14 +}: LegacyBadgeProps) {
15 return (
16 <span
11 - title="Legacy: superseded by sessions; kept for existing integrations"
17 + title={title}
18 className="not-prose inline-flex w-fit items-center gap-1.5 rounded-md border border-fd-border bg-fd-muted px-2 py-0.5 text-xs font-medium uppercase tracking-wide text-fd-muted-foreground"
19 >
20 Legacy
docs/content/reference/api-reference/connected-accounts/index.mdx
+1 -1
@@ -30,4 +30,4 @@ Shared-connection ACL fields are experimental and nested under an `experimental`
30
31 ## Endpoints
32
33 -<ApiEndpointsTable endpoints={[{"method":"POST","pathV31":"/api/v3.1/connected_accounts/{nanoid}/revoke","pathV3":"/api/v3/connected_accounts/{nanoid}/revoke","summary":"Revoke a connected account at the provider","href":"/reference/api-reference/connected-accounts/postConnectedAccountsByNanoidRevoke"},{"method":"GET","pathV31":"/api/v3.1/connected_accounts","pathV3":"/api/v3/connected_accounts","summary":"List connected accounts with optional filters","href":"/reference/api-reference/connected-accounts/getConnectedAccounts"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts","pathV3":"/api/v3/connected_accounts","summary":"Create a new connected account","href":"/reference/api-reference/connected-accounts/postConnectedAccounts"},{"method":"GET","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Get connected account details by ID","href":"/reference/api-reference/connected-accounts/getConnectedAccountsByNanoid"},{"method":"DELETE","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Delete a connected account","href":"/reference/api-reference/connected-accounts/deleteConnectedAccountsByNanoid"},{"method":"PATCH","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Update a connected account","href":"/reference/api-reference/connected-accounts/patchConnectedAccountsByNanoid"},{"method":"PATCH","pathV31":"/api/v3.1/connected_accounts/{nanoId}/status","pathV3":"/api/v3/connected_accounts/{nanoId}/status","summary":"Enable or disable a connected account","href":"/reference/api-reference/connected-accounts/patchConnectedAccountsByNanoIdStatus"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts/{nanoid}/refresh","pathV3":"/api/v3/connected_accounts/{nanoid}/refresh","summary":"Refresh authentication for a connected account","href":"/reference/api-reference/connected-accounts/postConnectedAccountsByNanoidRefresh"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts/link","pathV3":"/api/v3/connected_accounts/link","summary":"Create a new auth link session","href":"/reference/api-reference/connected-accounts/postConnectedAccountsLink"}]} />
33 +<ApiEndpointsTable endpoints={[{"method":"POST","pathV31":"/api/v3.1/connected_accounts/{nanoid}/revoke","pathV3":"/api/v3/connected_accounts/{nanoid}/revoke","summary":"Revoke a connected account at the provider","href":"/reference/api-reference/connected-accounts/postConnectedAccountsByNanoidRevoke"},{"method":"GET","pathV31":"/api/v3.1/connected_accounts","pathV3":"/api/v3/connected_accounts","summary":"List connected accounts with optional filters","href":"/reference/api-reference/connected-accounts/getConnectedAccounts"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts","pathV3":"/api/v3/connected_accounts","summary":"Create a new connected account","href":"/reference/api-reference/connected-accounts/postConnectedAccounts"},{"method":"GET","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Get connected account details by ID","href":"/reference/api-reference/connected-accounts/getConnectedAccountsByNanoid"},{"method":"DELETE","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Delete a connected account","href":"/reference/api-reference/connected-accounts/deleteConnectedAccountsByNanoid"},{"method":"PATCH","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Update a connected account","href":"/reference/api-reference/connected-accounts/patchConnectedAccountsByNanoid"},{"method":"PATCH","pathV31":"/api/v3.1/connected_accounts/{nanoId}/status","pathV3":"/api/v3/connected_accounts/{nanoId}/status","summary":"Enable or disable a connected account","href":"/reference/api-reference/connected-accounts/patchConnectedAccountsByNanoIdStatus"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts/{nanoid}/refresh","pathV3":"/api/v3/connected_accounts/{nanoid}/refresh","summary":"Refresh authentication for a connected account (DEPRECATED)","href":"/reference/api-reference/connected-accounts/postConnectedAccountsByNanoidRefresh","legacy":true},{"method":"POST","pathV31":"/api/v3.1/connected_accounts/link","pathV3":"/api/v3/connected_accounts/link","summary":"Create a new auth link session","href":"/reference/api-reference/connected-accounts/postConnectedAccountsLink"}]} />
docs/content/reference/api-reference/files/index.mdx
+1 -1
@@ -24,4 +24,4 @@ These endpoints use your project API key in the `x-api-key` header.
24
25 ## Endpoints
26
27 -<ApiEndpointsTable endpoints={[{"method":"GET","pathV31":"/api/v3.1/files/list","pathV3":"/api/v3/files/list","summary":"List files with optional app and action filters (DEPRECATED)","href":"/reference/api-reference/files/getFilesList"},{"method":"POST","pathV31":"/api/v3.1/files/upload/request","pathV3":"/api/v3/files/upload/request","summary":"Create presigned URL for request file upload to S3","href":"/reference/api-reference/files/postFilesUploadRequest"}]} />
27 +<ApiEndpointsTable endpoints={[{"method":"GET","pathV31":"/api/v3.1/files/list","pathV3":"/api/v3/files/list","summary":"List files with optional app and action filters (DEPRECATED)","href":"/reference/api-reference/files/getFilesList","legacy":true},{"method":"POST","pathV31":"/api/v3.1/files/upload/request","pathV3":"/api/v3/files/upload/request","summary":"Create presigned URL for request file upload to S3","href":"/reference/api-reference/files/postFilesUploadRequest"}]} />
docs/content/reference/v3/api-reference/connected-accounts/index.mdx
+1 -1
@@ -30,4 +30,4 @@ Shared-connection ACL fields are experimental and nested under an `experimental`
30
31 ## Endpoints
32
33 -<ApiEndpointsTable endpoints={[{"method":"GET","pathV31":"/api/v3.1/connected_accounts","pathV3":"/api/v3/connected_accounts","summary":"List connected accounts with optional filters","href":"/reference/v3/api-reference/connected-accounts/getConnectedAccounts"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts","pathV3":"/api/v3/connected_accounts","summary":"Create a new connected account","href":"/reference/v3/api-reference/connected-accounts/postConnectedAccounts"},{"method":"GET","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Get connected account details by ID","href":"/reference/v3/api-reference/connected-accounts/getConnectedAccountsByNanoid"},{"method":"DELETE","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Delete a connected account","href":"/reference/v3/api-reference/connected-accounts/deleteConnectedAccountsByNanoid"},{"method":"PATCH","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Update a connected account","href":"/reference/v3/api-reference/connected-accounts/patchConnectedAccountsByNanoid"},{"method":"PATCH","pathV31":"/api/v3.1/connected_accounts/{nanoId}/status","pathV3":"/api/v3/connected_accounts/{nanoId}/status","summary":"Enable or disable a connected account","href":"/reference/v3/api-reference/connected-accounts/patchConnectedAccountsByNanoIdStatus"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts/{nanoid}/refresh","pathV3":"/api/v3/connected_accounts/{nanoid}/refresh","summary":"Refresh authentication for a connected account","href":"/reference/v3/api-reference/connected-accounts/postConnectedAccountsByNanoidRefresh"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts/link","pathV3":"/api/v3/connected_accounts/link","summary":"Create a new auth link session","href":"/reference/v3/api-reference/connected-accounts/postConnectedAccountsLink"}]} />
33 +<ApiEndpointsTable endpoints={[{"method":"GET","pathV31":"/api/v3.1/connected_accounts","pathV3":"/api/v3/connected_accounts","summary":"List connected accounts with optional filters","href":"/reference/v3/api-reference/connected-accounts/getConnectedAccounts"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts","pathV3":"/api/v3/connected_accounts","summary":"Create a new connected account","href":"/reference/v3/api-reference/connected-accounts/postConnectedAccounts"},{"method":"GET","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Get connected account details by ID","href":"/reference/v3/api-reference/connected-accounts/getConnectedAccountsByNanoid"},{"method":"DELETE","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Delete a connected account","href":"/reference/v3/api-reference/connected-accounts/deleteConnectedAccountsByNanoid"},{"method":"PATCH","pathV31":"/api/v3.1/connected_accounts/{nanoid}","pathV3":"/api/v3/connected_accounts/{nanoid}","summary":"Update a connected account","href":"/reference/v3/api-reference/connected-accounts/patchConnectedAccountsByNanoid"},{"method":"PATCH","pathV31":"/api/v3.1/connected_accounts/{nanoId}/status","pathV3":"/api/v3/connected_accounts/{nanoId}/status","summary":"Enable or disable a connected account","href":"/reference/v3/api-reference/connected-accounts/patchConnectedAccountsByNanoIdStatus"},{"method":"POST","pathV31":"/api/v3.1/connected_accounts/{nanoid}/refresh","pathV3":"/api/v3/connected_accounts/{nanoid}/refresh","summary":"Refresh authentication for a connected account (DEPRECATED)","href":"/reference/v3/api-reference/connected-accounts/postConnectedAccountsByNanoidRefresh","legacy":true},{"method":"POST","pathV31":"/api/v3.1/connected_accounts/link","pathV3":"/api/v3/connected_accounts/link","summary":"Create a new auth link session","href":"/reference/v3/api-reference/connected-accounts/postConnectedAccountsLink"}]} />
docs/content/reference/v3/api-reference/files/index.mdx
+1 -1
@@ -24,4 +24,4 @@ These endpoints use your project API key in the `x-api-key` header.
24
25 ## Endpoints
26
27 -<ApiEndpointsTable endpoints={[{"method":"GET","pathV31":"/api/v3.1/files/list","pathV3":"/api/v3/files/list","summary":"List files with optional app and action filters (DEPRECATED)","href":"/reference/v3/api-reference/files/getFilesList"},{"method":"POST","pathV31":"/api/v3.1/files/upload/request","pathV3":"/api/v3/files/upload/request","summary":"Create presigned URL for request file upload to S3","href":"/reference/v3/api-reference/files/postFilesUploadRequest"}]} />
27 +<ApiEndpointsTable endpoints={[{"method":"GET","pathV31":"/api/v3.1/files/list","pathV3":"/api/v3/files/list","summary":"List files with optional app and action filters (DEPRECATED)","href":"/reference/v3/api-reference/files/getFilesList","legacy":true},{"method":"POST","pathV31":"/api/v3.1/files/upload/request","pathV3":"/api/v3/files/upload/request","summary":"Create presigned URL for request file upload to S3","href":"/reference/v3/api-reference/files/postFilesUploadRequest"}]} />
docs/public/openapi-v3.json
+3 -2
@@ -4807,8 +4807,9 @@
4807 },
4808 "/api/v3/connected_accounts/{nanoid}/refresh": {
4809 "post": {
4810 - "summary": "Refresh authentication for a connected account",
4811 - "description": "Initiates a new authentication flow for a connected account when credentials have expired or become invalid. This may generate a new authentication URL for OAuth flows or refresh tokens for other auth schemes.",
4810 + "summary": "Refresh authentication for a connected account (DEPRECATED)",
4811 + "description": "DEPRECATED: Manual refresh of a connected account is deprecated. Composio automatically refreshes credentials in the background as they approach expiry, so this endpoint is no longer required and may be removed in a future release. Initiates a new authentication flow for a connected account when credentials have expired or become invalid. This may generate a new authentication URL for OAuth flows or refresh tokens for other auth schemes.",
4812 + "deprecated": true,
4813 "tags": [
4814 "Connected Accounts"
4815 ],
docs/public/openapi.json
+3 -2
@@ -14264,8 +14264,9 @@
14264 },
14265 "/api/v3.1/connected_accounts/{nanoid}/refresh": {
14266 "post": {
14267 - "summary": "Refresh authentication for a connected account",
14268 - "description": "Initiates a new authentication flow for a connected account when credentials have expired or become invalid. This may generate a new authentication URL for OAuth flows or refresh tokens for other auth schemes.",
14267 + "summary": "Refresh authentication for a connected account (DEPRECATED)",
14268 + "description": "DEPRECATED: Manual refresh of a connected account is deprecated. Composio automatically refreshes credentials in the background as they approach expiry, so this endpoint is no longer required and may be removed in a future release. Initiates a new authentication flow for a connected account when credentials have expired or become invalid. This may generate a new authentication URL for OAuth flows or refresh tokens for other auth schemes.",
14269 + "deprecated": true,
14270 "tags": [
14271 "Connected Accounts"
14272 ],
docs/scripts/generate-api-index.ts
+11
@@ -31,6 +31,7 @@ interface OpenAPIOperation {
31 tags?: string[];
32 description?: string;
33 operationId?: string;
34 + deprecated?: boolean;
35 'x-api-version'?: string;
36 }
37
@@ -44,6 +45,7 @@ interface OperationEntry {
45 method: string;
46 path: string;
47 operationId: string;
48 + deprecated: boolean;
49 }
50
51 function slugify(text: string): string {
@@ -85,6 +87,7 @@ function getOperationsByTag(spec: OpenAPISpec): Record<string, OperationEntry[]>
87 method: method.toUpperCase(),
88 path,
89 operationId: operation.operationId || slugify(operation.summary || path),
90 + deprecated: operation.deprecated === true,
91 });
92 }
93 }
@@ -216,6 +219,10 @@ function generateIndexPages() {
219 pathV3: v3Op ? v3Op.path : op.path.replace('/v3.1/', '/v3/'),
220 summary: op.summary,
221 href: `/reference/api-reference/${tagSlug}/${op.operationId}`,
222 + // OpenAPI marks these `deprecated`; we surface them with the existing
223 + // "Legacy" tag rather than a separate one. Only emitted when true so
224 + // non-legacy pages stay byte-identical.
225 + ...(op.deprecated ? { legacy: true } : {}),
226 };
227 });
228
@@ -247,6 +254,10 @@ ${body}
254 pathV3: op.path,
255 summary: op.summary,
256 href: `/reference/v3/api-reference/${tagSlug}/${op.operationId}`,
257 + // OpenAPI marks these `deprecated`; we surface them with the existing
258 + // "Legacy" tag rather than a separate one. Only emitted when true so
259 + // non-legacy pages stay byte-identical.
260 + ...(op.deprecated ? { legacy: true } : {}),
261 }));
262
263 const v3Content = `---
docs/tests/static/api-deprecation.test.tsx new
+172
@@ -0,0 +1,172 @@
1 +import { afterEach, describe, expect, mock, test } from "bun:test";
2 +import { mkdtemp, mkdir, readFile, rm, writeFile } from "fs/promises";
3 +import { tmpdir } from "os";
4 +import { join } from "path";
5 +import { renderToStaticMarkup } from "react-dom/server";
6 +
7 +mock.module("next/navigation", () => ({
8 + usePathname: () => "/reference/api-reference/tasks",
9 +}));
10 +
11 +const { ApiEndpointsTable } = await import("../../components/api-endpoints-table");
12 +
13 +const DOCS_DIR = join(import.meta.dir, "../..");
14 +const GENERATOR_PATH = join(DOCS_DIR, "scripts/generate-api-index.ts");
15 +const fixtureDirectories: string[] = [];
16 +
17 +interface SerializedEndpoint {
18 + method: string;
19 + pathV31: string;
20 + pathV3: string;
21 + summary: string;
22 + href: string;
23 + legacy?: boolean;
24 +}
25 +
26 +function createSpec(version: "v3.1" | "v3") {
27 + return {
28 + tags: [{ name: "Tasks", description: "Task endpoints" }],
29 + paths: {
30 + [`/${version}/tasks/deprecated`]: {
31 + get: {
32 + tags: ["Tasks"],
33 + summary: "Deprecated task endpoint",
34 + operationId: "getDeprecatedTask",
35 + deprecated: true,
36 + },
37 + },
38 + [`/${version}/tasks/active`]: {
39 + post: {
40 + tags: ["Tasks"],
41 + summary: "Active task endpoint",
42 + operationId: "createTask",
43 + },
44 + },
45 + },
46 + };
47 +}
48 +
49 +function parseEndpoints(content: string): SerializedEndpoint[] {
50 + const prefix = "<ApiEndpointsTable endpoints={";
51 + const start = content.indexOf(prefix);
52 + const end = content.indexOf("} />", start);
53 +
54 + expect(start).toBeGreaterThanOrEqual(0);
55 + expect(end).toBeGreaterThan(start);
56 +
57 + return JSON.parse(content.slice(start + prefix.length, end));
58 +}
59 +
60 +function expectedEndpoints(hrefPrefix: string): SerializedEndpoint[] {
61 + return [
62 + {
63 + method: "GET",
64 + pathV31: "/v3.1/tasks/deprecated",
65 + pathV3: "/v3/tasks/deprecated",
66 + summary: "Deprecated task endpoint",
67 + href: `${hrefPrefix}/tasks/getDeprecatedTask`,
68 + legacy: true,
69 + },
70 + {
71 + method: "POST",
72 + pathV31: "/v3.1/tasks/active",
73 + pathV3: "/v3/tasks/active",
74 + summary: "Active task endpoint",
75 + href: `${hrefPrefix}/tasks/createTask`,
76 + },
77 + ];
78 +}
79 +
80 +async function generateFixture(): Promise<string> {
81 + const fixtureDir = await mkdtemp(join(tmpdir(), "composio-api-index-"));
82 + fixtureDirectories.push(fixtureDir);
83 +
84 + await mkdir(join(fixtureDir, "public"), { recursive: true });
85 + await writeFile(
86 + join(fixtureDir, "public/openapi.json"),
87 + JSON.stringify(createSpec("v3.1")),
88 + );
89 + await writeFile(
90 + join(fixtureDir, "public/openapi-v3.json"),
91 + JSON.stringify(createSpec("v3")),
92 + );
93 +
94 + const process = Bun.spawn([Bun.argv[0], GENERATOR_PATH], {
95 + cwd: fixtureDir,
96 + stdout: "pipe",
97 + stderr: "pipe",
98 + });
99 + const [exitCode, stderr] = await Promise.all([
100 + process.exited,
101 + new Response(process.stderr).text(),
102 + ]);
103 +
104 + if (exitCode !== 0) {
105 + throw new Error(`API index generator failed with exit code ${exitCode}: ${stderr}`);
106 + }
107 +
108 + return fixtureDir;
109 +}
110 +
111 +afterEach(async () => {
112 + await Promise.all(
113 + fixtureDirectories.splice(0).map(path => rm(path, { recursive: true })),
114 + );
115 +});
116 +
117 +describe("deprecated API endpoints", () => {
118 + test("serializes legacy only for deprecated v3.1 and v3 operations", async () => {
119 + const fixtureDir = await generateFixture();
120 + const v31Content = await readFile(
121 + join(fixtureDir, "content/reference/api-reference/tasks/index.mdx"),
122 + "utf-8",
123 + );
124 + const v3Content = await readFile(
125 + join(fixtureDir, "content/reference/v3/api-reference/tasks/index.mdx"),
126 + "utf-8",
127 + );
128 +
129 + const v31Endpoints = parseEndpoints(v31Content);
130 + const v3Endpoints = parseEndpoints(v3Content);
131 +
132 + expect(v31Endpoints).toEqual(expectedEndpoints("/reference/api-reference"));
133 + expect(v3Endpoints).toEqual(expectedEndpoints("/reference/v3/api-reference"));
134 +
135 + for (const endpoints of [v31Endpoints, v3Endpoints]) {
136 + expect(
137 + endpoints.find(endpoint => endpoint.summary === "Active task endpoint"),
138 + ).not.toHaveProperty("legacy");
139 + }
140 + });
141 +
142 + test("renders one Legacy badge for a deprecated endpoint and none for an active endpoint", () => {
143 + const html = renderToStaticMarkup(
144 + <ApiEndpointsTable
145 + endpoints={[
146 + {
147 + method: "GET",
148 + pathV31: "/v3.1/tasks/deprecated",
149 + pathV3: "/v3/tasks/deprecated",
150 + summary: "Deprecated task endpoint",
151 + href: "/reference/api-reference/tasks/getDeprecatedTask",
152 + legacy: true,
153 + },
154 + {
155 + method: "POST",
156 + pathV31: "/v3.1/tasks/active",
157 + pathV3: "/v3/tasks/active",
158 + summary: "Active task endpoint",
159 + href: "/reference/api-reference/tasks/createTask",
160 + },
161 + ]}
162 + />,
163 + );
164 +
165 + expect(
166 + html.match(
167 + /title="Deprecated API endpoint; kept for existing integrations and may be removed in a future release"/g,
168 + ),
169 + ).toHaveLength(1);
170 + expect(html.match(/>Legacy<\/span>/g)).toHaveLength(1);
171 + });
172 +});