Skip to content

Commit 98acf7f

Browse files
committed
fix: errata 8471 - group membership ref type is only group
1 parent 0029df7 commit 98acf7f

4 files changed

Lines changed: 4 additions & 7 deletions

File tree

doc/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Fixed
88
^^^^^
99
- Fix ``model_json_schema()`` generation for models containing :class:`~scim2_models.Reference` or :class:`~scim2_models.Path` fields. :issue:`125`
1010
- Group ``displayName`` is required. :rfc:`7643` `erratum 5368 <https://www.rfc-editor.org/errata/eid5368>`_ :issue:`123` :pr:`128`
11+
- :class:`~scim2_models.GroupMembership` ``$ref`` only references ``Group``. :rfc:`7643` `erratum 8471 <https://www.rfc-editor.org/errata/eid8471>`_
1112

1213
[0.6.2] - 2026-01-25
1314
--------------------

samples/rfc7643-8.7.1-schema-user.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@
572572
"name": "$ref",
573573
"type": "reference",
574574
"referenceTypes": [
575-
"User",
576575
"Group"
577576
],
578577
"multiValued": false,

scim2_models/resources/user.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import TYPE_CHECKING
33
from typing import Annotated
44
from typing import ClassVar
5-
from typing import Union
65

76
from pydantic import Base64Bytes
87
from pydantic import EmailStr
@@ -202,8 +201,8 @@ class GroupMembership(ComplexAttribute):
202201
value: Annotated[str | None, Mutability.read_only] = None
203202
"""The identifier of the User's group."""
204203

205-
ref: Annotated[ # type: ignore[type-arg]
206-
Reference[Union["User", "Group"]] | None,
204+
ref: Annotated[
205+
Reference["Group"] | None,
207206
Mutability.read_only,
208207
] = Field(None, serialization_alias="$ref")
209208
"""The reference URI of a target resource, if the attribute is a

tests/test_dynamic_resources.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,7 @@ def test_make_user_model_from_schema(load_sample):
857857
assert Groups.get_field_annotation("value", Uniqueness) == Uniqueness.none
858858

859859
# group.ref
860-
assert (
861-
Groups.get_field_root_type("ref") == Reference[Union["User", "Group"]] # noqa: F821
862-
)
860+
assert Groups.get_field_root_type("ref") == Reference["Group"] # noqa: F821
863861
assert not Groups.get_field_multiplicity("ref")
864862
assert (
865863
Groups.model_fields["ref"].description

0 commit comments

Comments
 (0)