Skip to content

Conversation

@davidhewitt
Copy link
Contributor

Change Summary

This cleans up a bunch of FIXME comments I left regarding state.model handling in #1860.

It turns out for the most part that a lot of the stuff going on in fields.rs was redundant because model and dataclass serializers were already setting state.model. However for TypedDict, the code in fields.rs was supposed to be setting the model... but it was doing so extremely inconsistenty, and with problems for nested typed dicts.

The added test fails on main, passes the wrong typed dict to the nested field serializer.

I simplified the control flow by just adding a thin TypedDictSerializer wrapper which sets the state up in the same way as is done for models and dataclasses.

Related issue number

N/A

Checklist

  • Unit tests for the changes exist
  • Documentation reflects the changes where applicable
  • Pydantic tests pass with this pydantic-core (except for expected changes)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@davidhewitt davidhewitt requested a review from Viicos November 1, 2025 18:42
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 1, 2025

CodSpeed Performance Report

Merging #1879 will not alter performance

Comparing dh/state-model (d165e68) with main (20d576b)

Summary

✅ 163 untouched

@davidhewitt davidhewitt merged commit bed9c14 into main Nov 3, 2025
32 checks passed
@davidhewitt davidhewitt deleted the dh/state-model branch November 3, 2025 12:24
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.

3 participants