data
data copied to clipboard
fix: remove internal record sanitization
Changes
- No longer sanitizes records during create/update to prevent infinite loops on circular objects (relations).
Motivation
The record sanitization we have is a workaround to help schema libraries parse circular objects. Ultimately, this isn't something Data should be doing. I see no reason schema libraries shouldn't support circular objects.
Todos
- [ ] Either land circular object support in Zod (https://github.com/colinhacks/zod/issues/5346) or find a schema library that supports it and migrate the tests to it to have them passing.
- [ ] Copy over the internal symbols as they aren't enumerable so schema validation libraries strip them, causing
Error: Failed to store foreign record reference for "country" relation: the referenced record ({"code":"us"}) is missing the primary key.