Логотип Deprecate Endpoint

Deprecate Endpoint

ОрганізаціяПопулярне
lightdash
deprecate-endpoint

Use when deprecating, sunsetting, or removing a backend HTTP API endpoint in Lightdash — wiring deprecation logging, deadline/sunset dates, response headers, and Sentry alerting onto a TSOA controller route. Also covers making the deprecation visible on docs.lightdash.com and llms.txt (description lead line, x-mint migration banner). Covers the first-party-caller precondition and the shared deprecation middleware.

Огляд

Видавецьlightdash
Репозиторійlightdash
Назва навичкиdeprecate-endpoint
Зірки
6.2K
Форки
790
Файли в пакеті
Лише інструкції
Посилання
  • Інструкції у форматі Markdown

    Файл SKILL.md, який модель завантажує за потреби, тож токени витрачаються лише тоді, коли запит справді відповідає навичці.

  • Працює з будь-якою LLM

    Навички ШІ — це звичайний Markdown, а не код для певного постачальника, тому вони працюють із GPT, Claude, Gemini, Grok або локальною моделлю.

  • Усе необхідне — в інструкціях

    Усе потрібне моделі міститься в інструкціях — жодних додаткових файлів для синхронізації.

  • Відкритий вихідний код

    Видавець на GitHub: lightdash. Перед установленням перегляньте вихідні файли навички.

Встановлення

Установіть навичку ШІ Deprecate Endpoint у TypingMind, щоб використовувати її з будь-якою LLM, або додайте її до іншого агента, що читає SKILL.md.

1

Встановити в TypingMind

TypingMind встановлює навичку безпосередньо з її папки на GitHub — читає SKILL.md, збирає файли ресурсів у пакет і зберігає результат локально.

  1. Відкрийте застосунок і перейдіть до розділу «Плагіни» → «Навички».
  2. Виберіть «Встановити з GitHub».
  3. Вставте наведений нижче URL папки навички та підтвердьте встановлення.
    https://github.com/lightdash/lightdash/tree/main/.claude/skills/deprecate-endpoint
  4. Увімкніть навичку в кожному чаті, де хочете її використовувати.
Плагіни → Навички → Додати навичку → За URL GitHub, потім вставте URL папки й натисніть «Продовжити».
2

Встановити в іншому агенті

Будь-який агент, що підтримує формат Agent Skills, може використовувати цю навичку — скопіюйте папку до каталогу навичок цього агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/lightdash/lightdash.git /tmp/lightdash
mkdir -p .claude/skills
cp -r /tmp/lightdash/.claude/skills/deprecate-endpoint .claude/skills/deprecate-endpoint
Після копіювання перезапустіть Claude Code, щоб завантажити нову навичку.

Використовуйте навичку в TypingMind

Увімкніть навичку Deprecate Endpoint в будь-якому чаті TypingMind, і далі модель усе зробить сама. Назва й опис навички містяться в системному промпті, а щойно надходить відповідний запит, модель самостійно завантажує повні інструкції — вам не потрібно викликати навичку вручну, і до фактичного використання вона не витрачає токенів.

Модель самостійно завантажує навичку Deprecate Endpoint, щойно надходить відповідний запит.

Працює з будь-якою моделлю ШІ

Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для певного постачальника, тому навичка Deprecate Endpoint не прив’язана до моделі, для якої її створено. Установіть її один раз у TypingMind і використовуйте з GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama або локальною моделлю, яку ви запускаєте самостійно, — усе з вашими власними ключами API.

  • Завантажується лише за потреби

    Системний промпт містить лише назву й опис. Інструкції завантажуються за першого відповідного запиту, тож поки навичка не потрібна, токени на її інструкції не витрачаються.

  • Змінюйте моделі під час чату

    Оскільки навичка — це інструкції, а не код, зміна моделі не порушує її роботу: наступна модель читає той самий файл SKILL.md.

Інструкції навички

Це вміст файлу SKILL.md, який завантажує модель. Прочитайте його перед установленням — навичка містить інструкції, яких дотримуватиметься ваша модель.

Deprecate an HTTP Endpoint

Checklist for deprecating a backend HTTP endpoint. The runtime behavior (warn→error logging, response headers) lives in one shared middleware — you only wire it on and supply a date + replacement hint.

The authoritative policy is packages/backend/src/controllers/CLAUDE.md → "Deprecating Endpoints". This skill is the actionable checklist.

Scope — endpoints only

Only HTTP route handlers (TSOA controllers) get the deprecation middleware. Internal service/model methods, type fields, DB columns, and config fields are not endpoints — mark those with a plain @deprecated JSDoc and stop there.

First, check current state

Read the handler before editing. It may already have some of the pieces (@deprecated JSDoc, @Deprecated(), the middleware) — only add what's missing.

Precondition (hard blocker)

Only deprecate an endpoint once nothing first-party calls it anymore. The frontend, CLI, EE code, and other internal consumers must already be migrated to the replacement. A deprecated route logs an error once past its deadline, so any straggler caller becomes log noise.

Verify before touching the controller — search every first-party surface for the route path and its API hooks, including EE and test suites:

bash
grep -rn "<route-fragment>" packages/frontend/src packages/cli/src \
  packages/common/src packages/backend/src/ee packages/api-tests packages/e2e

Watch for version differences: a v2 call (version: 'v2' / /api/v2/...) to a similar path is the replacement, not a caller of the v1 route. A test that hits the route counts as a caller — it will trigger error logs once past sunset. If any first-party caller remains, migrate it first (or stop — it cannot be deprecated yet).

Wire it up

In the controller, on the route handler:

  • Add the @deprecated JSDoc line naming the replacement. TSOA reads this tag to set deprecated: true in the OpenAPI spec.
  • Add the TSOA @Deprecated() decorator — the explicit, consistent way to mark it (decorator order doesn't matter). Keep both this and the JSDoc.
  • Rewrite the JSDoc description so its first line is plain text Deprecated — use the v2 <name> endpoint instead. (see "Make it visible in the docs" below for why this exact shape matters).
  • Add an @Extension('x-mint', ...) migration banner (same section below).
  • Add getDeprecatedRouteMiddleware to the handler's @Middlewares([...]) (use the same text for suffixMessage as the @deprecated JSDoc):
ts
import { getDeprecatedRouteMiddleware } from './authentication';

/**
 * Get role assignments for a project
 * @summary Get role assignments
 *
 * @deprecated Use GET /api/v2/.../roleAssignments instead
 */
@Middlewares([
    allowApiKeyAuthentication,
    isAuthenticated,
    getDeprecatedRouteMiddleware(new Date('2026-06-08'), {
        suffixMessage: 'Use GET /api/v2/.../roleAssignments instead.',
    }),
])
@Deprecated()

Keep the existing description and @summary lines in the JSDoc (lint requires @summary on every endpoint) and append the @deprecated line after a blank line.

  • new Date(...) is the date you are deprecating it (today). The removal/sunset date defaults to deprecatedOn + 3 months; only pass { removeOn: ... } when a different sunset has been agreed.
  • If the handler has no @Middlewares block (e.g. some embed routes), add one containing just the middleware.

Make it visible in the docs (description + x-mint)

deprecated: true alone is nearly invisible on docs.lightdash.com — AI agents and scripts reading the docs keep generating code against the route. The docs site auto-generates API pages and llms.txt from packages/backend/src/generated/swagger.json (main branch), so docs visibility is wired here, in the controller JSDoc:

  • The llms.txt entry is - [summary](url): first sentence of description (truncated ~60 chars), and the description renders as the page subtitle. So the description's first line must be plain text (no markdown links, no MDX) leading with the deprecation:
ts
/**
 * Deprecated — use the v2 Execute metric query endpoint instead.
 *
 * This endpoint was deprecated on <date> and will sunset on <date>. Migrate to
 * the v2 async query flow: Execute metric query, then Get results.
 * @summary Run metric query   // ⚠️ do NOT change — the docs page slug/URL is built from it
 * @deprecated Use POST /api/v2/projects/{projectUuid}/query/metric-query instead
 */
  • The visible banner on the endpoint page comes from the Mintlify x-mint: content OpenAPI extension (renders above the auto-generated reference; supports MDX). MDX in the plain description is NOT supported — don't put <Warning> there. Emit it with TSOA's @Extension (string must be a literal; backtick-escape inline code so {braces} don't break MDX):
ts
@Extension('x-mint', {
    content: `<Warning>
**This endpoint is deprecated and will sunset on <date>.**

Migrate to [Execute metric query](https://docs.lightdash.com/api-reference/v2/execute-metric-query) (\`POST /api/v2/projects/{projectUuid}/query/metric-query\`), then [Get results](https://docs.lightdash.com/api-reference/v2/get-results).
</Warning>`,
})
  • Run pnpm generate-api and check the swagger.json diff: the operation keeps deprecated: true, summary unchanged, description starts with the plain-text Deprecated — ... sentence, and x-mint is present. Expect unrelated key-reordering drift in generated files — to keep the PR clean, revert generated files to HEAD, graft only the changed operation objects, then pnpm -F backend formatter --write ./src/generated/swagger.json.

Docs go live on the next mintlify-docs deploy after the backend change reaches main (the docs site re-fetches swagger.json from main at build time).

You get this for free

getDeprecatedRouteMiddleware (controllers/authentication/deprecation.ts) already does, per call:

  • Deprecation, Sunset, and legacy Warning response headers.
  • A warning log, escalating to an error log (GCP) once the sunset is within two weeks or has passed. Do not report DeprecatedRouteError to Sentry — it is in IGNORE_ERRORS and would burn quota on every call.

Do not add per-endpoint logging/headers. (Some older routes also fire a trackDeprecatedRouteCalled analytics event — that's optional; the middleware is the standard.)

Later: removal

Once the sunset passes (the route is now error-logging on every call), the follow-up task is to delete the handler and its route, then pnpm generate-api again. That's a separate change, not part of deprecating.

Поширені запитання

Що робить навичка ШІ Deprecate Endpoint?

Use when deprecating, sunsetting, or removing a backend HTTP API endpoint in Lightdash — wiring deprecation logging, deadline/sunset dates, response headers, and Sentry alerting onto a TSOA controller route. Also covers making the deprecation visible on docs.lightdash.com and llms.txt (description lead line, x-mint migration banner). Covers the first-party-caller precondition and the shared deprecation middleware.

Навіщо використовувати Deprecate Endpoint у TypingMind?

Тому що ви встановлюєте її один раз і використовуєте з будь-якою моделлю. Deprecate Endpoint — це звичайний Markdown, а не код для конкретного постачальника, тому та сама навичка працює з GPT-5, Claude, Gemini, Grok або локальною моделлю. Ви можете змінити модель навіть посеред чату, і навичка продовжить працювати. TypingMind використовує ваші власні ключі API, тож ви платите безпосередньо постачальникам замість передплати за кожне місце користувача, а ваші навички й чати залишаються у вашому сховищі.

Як встановити Deprecate Endpoint у TypingMind?

Відкрийте в TypingMind Плагіни → Навички → Встановити з GitHub і вставте https://github.com/lightdash/lightdash/tree/main/.claude/skills/deprecate-endpoint. TypingMind прочитає файл SKILL.md і встановить навичку, яку можна вмикати окремо для кожного чату.

Які моделі ШІ можуть використовувати Deprecate Endpoint?

Будь-яка модель, яку ви підключите в TypingMind. Навички ШІ — це звичайні інструкції у форматі Markdown, а не код для конкретного постачальника, тому GPT, Claude, Gemini, Grok і локальні моделі можуть завантажувати цю навичку, коли запит їй відповідає.

Зі скількома моделями ШІ можна використовувати Deprecate Endpoint?

Зі скількома забажаєте. У TypingMind ви можете використовувати Deprecate Endpoint із будь-якою моделлю, яка підтримує навички, зокрема з GPT, Claude, Gemini, Grok, DeepSeek, Mistral чи Llama. Для цього ви використовуєте власні ключі API.

Чи безкоштовна навичка ШІ Deprecate Endpoint?

На GitHub цю навичку публікує lightdash. Умови ліцензування дивіться в репозиторії. Ви платите лише своєму постачальнику ШІ за використані токени.

Що таке навички ШІ?

Навичка ШІ — це набір інструкцій для повторного використання, який навчає модель ШІ виконувати одне конкретне завдання. Він відповідає відкритому формату Agent Skills: файл SKILL.md із назвою та описом, а також скрипти, шаблони чи довідкові файли, які можуть знадобитися моделі. Модель читає інструкції лише тоді, коли ваш запит відповідає навичці, тому встановлена навичка нічого не коштує, доки її не використано.

Чим навички ШІ відрізняються від плагінів або серверів MCP?

Плагін або сервер MCP надає моделі нові інструменти, які вона може викликати, — код, який десь виконується й повертає результат. Натомість навичка ШІ дає моделі знання й пояснює порядок дій: як підійти до завдання, яких кроків дотримуватися та яким має бути якісний результат. Навички — це звичайний Markdown, тож їм не потрібні ні сервер, ні ключ API, ні середовище виконання, і вони працюють із будь-якою моделлю.

Усі

Створіть власний робочий простір зі ШІ вже зараз

Підпишіться на нашу розсилку, щоб дізнаватися про нові функції та майбутні розіграші 👇