data icon indicating copy to clipboard operation
data copied to clipboard

fix: remove internal record sanitization

Open kettanaito opened this issue 2 months ago • 0 comments

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.

kettanaito avatar Oct 16 '25 11:10 kettanaito