You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(types): accept term() for encoder input to support structs
The Toon.Encoder protocol normalizes input before encoding, so the
public API should accept any term() - not just pre-normalized types.
Changes:
- Add Toon.Types.input() type as term() for encoder parameters
- Update encode/1,2 and encode!/1,2 specs to use input()
- Keep encodable() for normalized output (string-keyed maps)
- Add tests for struct and atom-key encoding via public API
This fixes Dialyzer warnings when calling Toon.encode!/1 with:
- Ecto schemas (structs with atom keys)
- Maps with atom keys
- Any type implementing the Toon.Encoder protocol
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments