Skip to content

Fix from_dict for Optional values in collections#733

Merged
yukinarit merged 1 commit intoyukinarit:mainfrom
AllanChain:fix/inner-opt
Mar 19, 2026
Merged

Fix from_dict for Optional values in collections#733
yukinarit merged 1 commit intoyukinarit:mainfrom
AllanChain:fix/inner-opt

Conversation

@AllanChain
Copy link
Copy Markdown
Contributor

The following fixes are applied with the help of LLM agent:

  • Fix DeField.__getitem__ to preserve InnerField type when unwrapping Optional inside a collection, so the generated code accesses the loop variable directly instead of indexing into it by name
  • Fix Renderer.opt() to use a simple is not None check for InnerField instead of applying the datavar.get("fieldname") pattern meant for named dataclass fields

Fixes #732

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.81%. Comparing base (f09d503) to head (227f1f8).
⚠️ Report is 66 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #733      +/-   ##
==========================================
- Coverage   90.83%   90.81%   -0.02%     
==========================================
  Files          13       13              
  Lines        2040     2308     +268     
  Branches      370      449      +79     
==========================================
+ Hits         1853     2096     +243     
- Misses        124      141      +17     
- Partials       63       71       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yukinarit yukinarit added the bug Bug report or fix label Mar 19, 2026
Copy link
Copy Markdown
Owner

@yukinarit yukinarit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@yukinarit yukinarit merged commit e56d2be into yukinarit:main Mar 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bug report or fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

from_dict deserializes Optional values in collections as None

2 participants