chore: convert endpoints do openApi
Merged
GG
6mo ago+5935+5935+0123456789012345678901234567890123456789-3111-3111-0123456789012345678901234567890123456789
OpenAPI Endpoint Migration
Migrates API endpoints from legacy addRoute to typed .get()/.post() with AJV schema validation for request and response payloads.
Migration Progress
| Area | Status | Endpoints |
|---|---|---|
| info, stats, mailer | ✅ Migrated | 4 |
| push, subscriptions | ✅ Migrated | 6 |
| invites, custom-user-status, emoji-custom | ✅ Migrated | 8 |
| commands | ✅ Migrated | 5 |
| dm/im | ✅ Migrated | 12 |
| chat, autotranslate | ✅ Migrated | 14 |
| misc (spotlight, shield.svg) | ✅ Migrated | 3 |
| rooms | ✅ Migrated (partial) | 28 |
| teams | ✅ Migrated | 16 |
| users | ✅ Migrated (partial) | 24 |
| integrations, moderation | ✅ Migrated | 6 |
| channels | ❌ Remaining | 42 |
| groups | ❌ Remaining | 38 |
| rooms (remaining) | ❌ Remaining | 2 |
| users (remaining) | ❌ Remaining | 2 |
~66% migrated — 84 addRoute endpoints remaining (mostly channels and groups).
What's Included
- Ajv 2020-12 upgrade — enables
unevaluatedPropertiesfor stricter schemas - Core/rest typings updates —
IMeApiUser,ISubscription,IRoom,IIntegrationtype improvements - API framework —
forbidden()/unauthorized()/success()signature updates,SuccessStatusCodessupport - Response validation —
$refschemas for typed responses,validateBadRequestErrorResponse/validateUnauthorizedErrorResponse/validateForbiddenErrorResponse - Test updates — assertions updated for new error formats and ajv coercion behavior
- Client-side fixes — type adjustments for
readStateManager,userData,mapSubscriptionFromApi,RoomsTable,EditRoomInfo
Weak Schemas
508 response schemas still use { type: 'object' } without properties or $ref. These are functional but should be strengthened incrementally.
Commits (each migration is independently revertible)
Each commit contains the endpoint migration + its tests + related type fixes:
chore: upgrade Ajv to 2020-12 and update core/rest typingschore: API framework changeschore(api): migrate info, stats, mailerchore(api): migrate push, subscriptionschore(api): migrate invites, custom-user-status, emoji-customchore(api): migrate commandschore(api): migrate dm/imchore(api): migrate chat, autotranslatechore(api): migrate miscchore(api): migrate roomschore(api): migrate teamschore(api): migrate userschore(api): migrate integrations, moderationchore: add migration tracking scripts and docs
Task: ARCH-2063