1.4 KiB
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_infor write operations).
Implementation Details
1. Database Metadata
- Execute
DESCRIBE {table_name}orSHOW 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.