Normalize UID references through the field manager, not the setter - #100
Open
ramonski wants to merge 2 commits into
Open
Normalize UID references through the field manager, not the setter#100ramonski wants to merge 2 commits into
ramonski wants to merge 2 commits into
Conversation
ramonski
added a commit
that referenced
this pull request
Jul 27, 2026
DexterityDataManager.set prioritized a content-type set<Name> mutator over the field manager. For a UID reference field (e.g. Department's manager) that bypassed UIDReferenceFieldMixin's normalization, so a unicode UID from a JSON payload was stored verbatim and later failed the field's ASCIILine value_type validation with WrongContainedType. Route UID reference fields through their field manager (which resolves objects/paths and coerces UIDs to native str). Every other field keeps prioritizing the setter, which also covers BBB properties that have no schema field (e.g. Department.DepartmentID).
ramonski
force-pushed
the
feature/normalize-dx-uid-references
branch
from
July 27, 2026 10:32
af6906b to
90ba4aa
Compare
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
DexterityDataManager.setnow routes UID reference fields through their field manager instead of a content-typeset<Name>mutator, so reference values are normalized before they are stored.Why
DexterityDataManager.setprioritized aset<Name>setter over the field manager. For a UID reference field (for exampleDepartment.manager), the auto-generated setter just calls the field mutator with the raw value, bypassingUIDReferenceFieldMixin's normalization (resolve objects/paths, coerce UIDs to nativestr).A UID posted as JSON arrives as unicode. Stored verbatim, it then fails the field's validation, because
UIDReferenceFieldis aListwhosevalue_typeisASCIILine(nativestrin py2):This blocked creating any object with a required single-valued DX UID reference through the API (Department, and therefore AnalysisCategory, ...).
Change
In
DexterityDataManager.set, skip the raw setter and use the field manager when the field manager is aUIDReferenceFieldMixin(AT or DX UID reference). The field manager normalizes the value and still ends at the field mutator, so no setter side effects are lost; all other fields keep using their setter.Verification
Reproduces with
Department.managervia the JSON API before the change (WrongContainedType) and creates successfully after. Pairs with #99, which surfaced the underlying error in the first place.Stacking
Stacked on top of #99 (
feature/report-create-errors).