diff --git a/samples/rfc7643-8.7.1-schema-enterprise_user.json b/samples/rfc7643-8.7.1-schema-enterprise_user.json index 9d9feb9e..76e74886 100644 --- a/samples/rfc7643-8.7.1-schema-enterprise_user.json +++ b/samples/rfc7643-8.7.1-schema-enterprise_user.json @@ -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", @@ -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", diff --git a/scim2_models/resources/enterprise_user.py b/scim2_models/resources/enterprise_user.py index 01e37fc5..e5a3078b 100644 --- a/scim2_models/resources/enterprise_user.py +++ b/scim2_models/resources/enterprise_user.py @@ -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 diff --git a/tests/test_bulk.py b/tests/test_bulk.py index 3531a0fe..e1e3f129 100644 --- a/tests/test_bulk.py +++ b/tests/test_bulk.py @@ -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(): diff --git a/tests/test_dynamic_resources.py b/tests/test_dynamic_resources.py index e5df065b..2d130ce2 100644 --- a/tests/test_dynamic_resources.py +++ b/tests/test_dynamic_resources.py @@ -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 @@ -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