feat(api): migrate users.getPreferences to OpenAPI pattern

Closed
MO
5mo ago
+39-13

Description:

This PR completes the migration of the users.getPreferences endpoint to the new OpenAPI + AJV pattern. It introduces robust schema validation for responses, improves type safety by utilizing ExtractRoutesFromAPI, and ensures the endpoint is fully documented and verified within the Swagger UI.

Key Changes:

Full Migration: Moved users.getPreferences to the new API pattern with compiled AJV validation.

Swagger Documentation: Included the response block in the route definition to enable automatic documentation generation in the API Explorer.

Typing Cleanup: Purged legacy manual interfaces and endpoint types from packages/rest-typings to ensure a single source of truth via ExtractRoutesFromAPI.

Linting & Formatting: Resolved all spacing and formatting issues by running yarn lint -- --fix.

Testing & Verification:

Swagger UI: Verified at /api-docs/. The schema correctly reflects the validated response structure.

Functional Test: Successfully authorized and executed the endpoint in the Swagger explorer, receiving a 200 OK with the expected user preferences.

E2E Tests: Ran yarn testapi --grep users.getPreferences in apps/meteor; all assertions passed.

Successful API Response (200 OK):
Screenshot 2026-01-28 194148

Ready for final review and merge.

Summary by CodeRabbit

  • New Features

    • Public typing and response validation added for the users.getPreferences endpoint to ensure consistent successful responses.
  • Bug Fixes

    • Improved error handling for users.getPreferences, returning standardized errors for invalid or unauthorized requests.
    • Preferences and language are now reliably derived from user settings for more accurate results.
  • Chores

    • Migration note and patch release metadata added for the endpoint update.

COMM-144