Skip to content

fix: record deserialization with $ref metadata#44

Merged
keithdv merged 1 commit intomainfrom
fix/record-deserialization-ref-metadata
Mar 21, 2026
Merged

fix: record deserialization with $ref metadata#44
keithdv merged 1 commit intomainfrom
fix/record-deserialization-ref-metadata

Conversation

@keithdv
Copy link
Contributor

@keithdv keithdv commented Mar 20, 2026

Summary

  • Fix ObjectWithParameterizedCtorRefMetadataNotSupported when Interface Factory methods return records with parameterized constructors
  • Dual JsonSerializerOptions in NeatooJsonSerializer — Neatoo types keep ReferenceHandler.Preserve, plain records/DTOs get clean options without $id/$ref metadata
  • New anti-pattern documented: mixing Neatoo types with records in Interface Factory return types
  • Version bump to v0.21.3

Breaking Change

Non-Neatoo types no longer emit $id/$ref in JSON wire format. Clients and servers must be updated together.

Test plan

  • 6 new integration tests (simple record, record with collection, nested records, nullable, JSON inspection)
  • 1 new Design project test (record return type round-trip)
  • All existing tests pass (490 unit + 487 integration + 42 design per TFM)
  • Verified on both net9.0 and net10.0

🤖 Generated with Claude Code

NeatooJsonSerializer's global ReferenceHandler.Preserve caused
ObjectWithParameterizedCtorRefMetadataNotSupported when Interface
Factory methods returned records with parameterized constructors.

Fix: dual JsonSerializerOptions — Neatoo types keep ReferenceHandler
for $id/$ref tracking, plain records/DTOs use clean options without
reference metadata. Type classification via IsNeatooType().

Breaking: non-Neatoo types no longer emit $id/$ref in JSON wire format.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@keithdv keithdv merged commit 256e113 into main Mar 21, 2026
2 checks passed
@keithdv keithdv deleted the fix/record-deserialization-ref-metadata branch March 21, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant