-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Enhancement Request
DynamicTable.validateRows() currently only validates fields that ARE defined in the schema. Fields in the row object that are NOT in the schema are silently passed through to the AppSheet API.
Current Behavior
// DynamicTable.validateRows() (simplified, lines 62-81)
for (const field of schemaFields) {
validateFieldType(row[field.name], field.type);
}
// ← Fields in row that are NOT in schema are IGNORED
// ← They pass through 1:1 to the AppSheet APIWhen a consumer accidentally adds a field that doesn't exist in the AppSheet table (e.g. id, or a renamed field like type instead of types), validateRows() does not catch it. The invalid field is sent to the API, which rejects with:
"Failed to get rows due to: 'id' is not a valid table column name.."
Expected Behavior
As a defense-in-depth measure, DynamicTable should detect fields in the row object that are not defined in the table schema. Options (configurable):
- Warn — Log a warning for unknown fields (non-breaking)
- Strip — Remove unknown fields before sending to API (safe default)
- Strict mode — Throw an error for unknown fields (opt-in)
Suggested API
// Option A: Configuration on DynamicTable
const table = schemaManager.table<Solution>('default', 'solution', email, {
unknownFields: 'strip' // 'warn' | 'strip' | 'error' | 'ignore' (default)
});
// Option B: Global SchemaManager configuration
const schemaManager = new SchemaManager(factory, schema, {
unknownFieldPolicy: 'warn'
});Use Cases This Would Catch
- Stale field names after rename — e.g.
typeinstead oftypesafter schema migration - Mock workaround fields — e.g. adding
idfield for MockAppSheetClient compatibility - Typos in field names — e.g.
desciptioninstead ofdescription
Impact
- Low risk enhancement — current behavior (
ignore) remains the default - Would have prevented BUG-ASUP-001 and BUG-ASUP-002 in
service_portfolio_mcp - The schema already contains all field definitions — the information is available
Environment
@techdivision/appsheetv3.1.0- Discovered in:
service_portfolio_mcpproject
Related
- Downstream bugs prevented: BUG-ASUP-001 (stale field names), BUG-ASUP-002 (extra id field)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request