Skip to content

Conversation

@nnpvaan
Copy link
Contributor

@nnpvaan nnpvaan commented Nov 25, 2025

Description of the issue/feature this PR addresses

Fix WrongType errors when setting DX UIDReferenceField values via JSONAPI push, e.g. for IClientShareableBehavior.clients, by normalizing collected UIDs to native strings before field validation.

Current behavior before PR

Creating or updating objects through JSONAPI push that include UIDReferenceField values (notably IClientShareableBehavior.clients) fails with an error similar to:

Cannot create object: TypeError - WrongType: Field=senaite.core.behaviors.clientshareable.IClientShareableBehavior.clients Value=[u'...']

because the underlying List(ASCIILine) receives a list of Unicode UIDs instead of native str, causing WrongType/WrongContainedType during validation.

Desired behavior after PR is merged

UID reference field manager normalizes all collected references to native str UIDs before calling the field’s setter, so creating/updating objects with UIDReferenceField values (including clients) via JSONAPI succeeds and relations/backrefs are stored correctly, without raising WrongType errors.

--
I confirm I have tested the PR thoroughly and coded it according to PEP8
standards.

Copy link
Member

@xispa xispa left a comment

Choose a reason for hiding this comment

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

Thanks!

@xispa xispa merged commit 7051e5d into senaite:2.x Nov 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants