← Back to list
01Issue
BugClosedSwamp Club
AssigneesNone
Schema mismatch warnings lack model context and misrepresent API response shapes
Opened by swampadmin · 5/20/2025
Summary
When extension models write resource data, the data-writer emits schema validation warnings that (1) don't identify which model triggered them, and (2) are caused by the extension model's Zod schema not matching the actual API response shape.
Steps to Reproduce
- Create a droplet model and run
create:swamp model create @stack72/digitalocean/droplet web-droplet swamp model method run web-droplet create --input '{"dropletName": "web-1"}' - Observe the warning in logs:
19:53:43.028 warning swamp·data-writer Resource '"state"' data does not match schema: 'Invalid input: expected object, received null at "kernel"; Invalid input: expected object, received null at "next_backup_window"; Invalid option: expected one of "nyc1"|"sfo1"|... at "region"'
Expected Behavior
- The warning should identify which model and instance triggered it (e.g.
swamp·data-writer·web-droplet·web-1) - The extension model's schema should match the actual DO API response shape, not just the request shape
Actual Behavior
Three schema mismatches, all caused by the extension model's Zod schema being modeled on the request shape rather than the response shape:
kernel: Schema expects an object, DO API returnsnull(no kernel selected on the droplet)next_backup_window: Schema expects an object, DO API returnsnull(backups not enabled)region: Schema expects a string enum ("lon1"), but the DO API response returns an expanded object:{"name": "London 1", "slug": "lon1", "features": [...], ...}
The data saves correctly (via .passthrough()), so these warnings are pure noise. But they're indistinguishable from a real data corruption problem.
Impact
- With multiple models running in parallel in a workflow, there's no way to tell which model produced the warning
- Users cannot distinguish "harmless schema mismatch in the extension" from "your data is actually wrong"
- The warnings appear on every create/get operation, training users to ignore all warnings
Suggested Fix
- data-writer: Include the model name and instance name in the log context (e.g.
swamp·data-writer·web-droplet·web-1) - @stack72/digitalocean/droplet schema: Update the Zod schema to match the API response shape —
kernelandnext_backup_windowshould be nullable,regionshould be an object (not a string enum)
Environment
- swamp extension:
@stack72/digitalocean/dropletv2026.03.05.6 - OS: macOS (Darwin 25.2.0)
02Bog Flow
Closed
No activity in this phase yet.
03Sludge Pulse
Sign in to post a ripple.