Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions samples/rfc7643-8.7.1-schema-enterprise_user.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"name": "value",
"type": "string",
"multiValued": false,
"description": "The id of the SCIM resource representing the User's manager. REQUIRED.",
"description": "The id of the SCIM resource representing the User's manager. RECOMMENDED.",
"required": true,
"caseExact": true,
"mutability": "readWrite",
Expand All @@ -84,8 +84,8 @@
"User"
],
"multiValued": false,
"description": "The URI of the SCIM resource representing the User's manager. REQUIRED.",
"required": true,
"description": "The URI of the SCIM resource representing the User's manager. RECOMMENDED.",
"required": false,
"caseExact": true,
"mutability": "readWrite",
"returned": "default",
Expand Down
7 changes: 3 additions & 4 deletions scim2_models/resources/enterprise_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ class Manager(ComplexAttribute):
value: Annotated[str | None, Required.true, CaseExact.true] = None
"""The id of the SCIM resource representing the User's manager."""

ref: Annotated[ # type: ignore[type-arg]
Reference["User"] | None,
Required.true,
] = Field(None, serialization_alias="$ref", validation_alias="$ref")
ref: Reference["User"] | None = Field( # type: ignore[type-arg]
None, serialization_alias="$ref", validation_alias="$ref"
)
"""The URI of the SCIM resource representing the User's manager."""

display_name: Annotated[str | None, Mutability.read_only] = None
Expand Down
15 changes: 4 additions & 11 deletions tests/test_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,17 +575,10 @@ def operation(manager):
operation({"value": "bulkId:ytrewq"}), scim_ctx=Context.BULK_REQUEST
)

with pytest.raises(ValidationError):
BulkOperation[User[EnterpriseUser]].model_validate(
operation({"value": "2819c223-7f76-453a-919d-413861904646"}),
scim_ctx=Context.BULK_REQUEST,
)

with pytest.raises(ValidationError):
BulkOperation[User[EnterpriseUser]].model_validate(
operation({"value": "bulkId:ytrewq"}),
scim_ctx=Context.RESOURCE_CREATION_REQUEST,
)
BulkOperation[User[EnterpriseUser]].model_validate(
operation({"value": "2819c223-7f76-453a-919d-413861904646"}),
scim_ctx=Context.BULK_REQUEST,
)


def test_bulk_models_require_a_type_parameter():
Expand Down
6 changes: 3 additions & 3 deletions tests/test_dynamic_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ def test_make_enterprise_user_model_from_schema(load_sample):
assert not Manager.get_field_multiplicity("value")
assert (
Manager.model_fields["value"].description
== "The id of the SCIM resource representing the User's manager. REQUIRED."
== "The id of the SCIM resource representing the User's manager. RECOMMENDED."
)
assert Manager.get_field_annotation("value", Required) == Required.true
assert Manager.get_field_annotation("value", CaseExact) == CaseExact.true
Expand All @@ -1403,9 +1403,9 @@ def test_make_enterprise_user_model_from_schema(load_sample):
assert not Manager.get_field_multiplicity("ref")
assert (
Manager.model_fields["ref"].description
== "The URI of the SCIM resource representing the User's manager. REQUIRED."
== "The URI of the SCIM resource representing the User's manager. RECOMMENDED."
)
assert Manager.get_field_annotation("ref", Required) == Required.true
assert Manager.get_field_annotation("ref", Required) == Required.false
assert Manager.get_field_annotation("ref", CaseExact) == CaseExact.true
assert Manager.get_field_annotation("ref", Mutability) == Mutability.read_write
assert Manager.get_field_annotation("ref", Returned) == Returned.default
Expand Down