diff --git a/samples/rfc7643-8.7.1-schema-group.json b/samples/rfc7643-8.7.1-schema-group.json index bc564b4..6ac48e0 100644 --- a/samples/rfc7643-8.7.1-schema-group.json +++ b/samples/rfc7643-8.7.1-schema-group.json @@ -9,7 +9,7 @@ "type": "string", "multiValued": false, "description": "A human-readable name for the Group. REQUIRED.", - "required": false, + "required": true, "caseExact": false, "mutability": "readWrite", "returned": "default", diff --git a/scim2_models/resources/group.py b/scim2_models/resources/group.py index d520aab..fd3cfe1 100644 --- a/scim2_models/resources/group.py +++ b/scim2_models/resources/group.py @@ -7,6 +7,7 @@ from pydantic import Field from ..annotations import Mutability +from ..annotations import Required from ..attributes import ComplexAttribute from ..path import URN from ..reference import Reference @@ -38,7 +39,7 @@ class GroupMember(ComplexAttribute): class Group(Resource[Any]): __schema__ = URN("urn:ietf:params:scim:schemas:core:2.0:Group") - display_name: str | None = None + display_name: Annotated[str | None, Required.true] = None """A human-readable name for the Group.""" members: list[GroupMember] | None = None diff --git a/tests/test_dynamic_resources.py b/tests/test_dynamic_resources.py index 9fd55b0..4fb649d 100644 --- a/tests/test_dynamic_resources.py +++ b/tests/test_dynamic_resources.py @@ -32,7 +32,7 @@ def test_make_group_model_from_schema(load_sample): Group.model_fields["display_name"].description == "A human-readable name for the Group. REQUIRED." ) - assert Group.get_field_annotation("display_name", Required) == Required.false + assert Group.get_field_annotation("display_name", Required) == Required.true assert Group.get_field_annotation("display_name", CaseExact) == CaseExact.false assert ( Group.get_field_annotation("display_name", Mutability) == Mutability.read_write @@ -2712,7 +2712,7 @@ def test_make_schema_model_from_schema(load_sample): assert obj.attributes[0].description == ( "A human-readable name for the Group. REQUIRED." ) - assert not obj.attributes[0].required + assert obj.attributes[0].required assert not obj.attributes[0].case_exact assert obj.attributes[0].mutability == Mutability.read_write assert obj.attributes[0].returned == Returned.default diff --git a/tests/test_schema.py b/tests/test_schema.py index c15f9a9..4c8ac6f 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -21,7 +21,7 @@ def test_group_schema(load_sample): assert obj.attributes[0].description == ( "A human-readable name for the Group. REQUIRED." ) - assert not obj.attributes[0].required + assert obj.attributes[0].required assert not obj.attributes[0].case_exact assert obj.attributes[0].mutability == Mutability.read_write assert obj.attributes[0].returned == Returned.default