Files
OSIT-AE-API-FastAPI/documentation/archive/PLAN__V3_SCHEMA_DISCOVERY.md
Scott Idem 860cf80a4e Documentation Standardisation & Unit Test Stabilization
- Overhauled README.md to serve as a unified system index and WIP tracker.
- Standardized documentation filenames (ARCH__, GUIDE__, PLAN__) for better discoverability.
- Archived completed project plans and scopes.
- Fixed regressions in unit tests (errors, models, email) caused by V3 architectural updates.
- Ensured unit tests remain non-destructive and environment-independent via mocking.
2026-01-28 12:15:01 -05:00

1.4 KiB

Aether V3 Schema Discovery Plan

Objective

Provide an endpoint that returns the structure of an Aether object type, combining database metadata with Pydantic model definitions. This helps the frontend adapt to schema changes and understand field types/aliases without hardcoding.

Proposed Endpoint

GET /v3/crud/{obj_type}/schema

Query Parameters

  • view: (Optional) default, enriched, detail. Determines which database table/view and Pydantic model to inspect.
  • variant: (Optional) in, out, base. Selects the specific Pydantic model variant (e.g., mdl_in for write operations).

Implementation Details

1. Database Metadata

  • Execute DESCRIBE {table_name} or SHOW COLUMNS FROM {table_name}.
  • Extract: Field, Type, Null, Key, Default, Extra.

2. Pydantic Metadata

  • Inspect the model's __fields__.
  • Map Pydantic field names to database aliases.
  • Extract: type, required, default, description (from Field extra), validators.

3. Response Structure

{
  "object_type": "account",
  "database": {
    "table_name": "account",
    "columns": [...]
  },
  "model": {
    "model_name": "Account_Base",
    "fields": {
      "account_id_random": {
        "alias": "id_random",
        "type": "string",
        "required": false
      },
      ...
    }
  }
}

Security

  • Requires standard V3 authentication.
  • Only returns schema for objects defined in obj_type_kv_li.