|
9 | 9 | from typing import get_args |
10 | 10 | from typing import get_origin |
11 | 11 |
|
12 | | -if TYPE_CHECKING: |
13 | | - from scim2_models.rfc7643.schema import Attribute |
14 | | - from scim2_models.rfc7643.schema import Schema |
15 | | - |
16 | 12 | from pydantic import Field |
17 | 13 | from pydantic import WrapSerializer |
18 | 14 | from pydantic import field_serializer |
|
30 | 26 | from ..base import BaseModel |
31 | 27 | from ..base import BaseModelType |
32 | 28 | from ..reference import Reference |
| 29 | +from ..scim_object import SchemaObject |
| 30 | +from ..scim_object import ScimObject |
33 | 31 | from ..utils import UNION_TYPES |
34 | 32 | from ..utils import normalize_attribute_name |
35 | 33 |
|
| 34 | +if TYPE_CHECKING: |
| 35 | + from .schema import Attribute |
| 36 | + from .schema import Schema |
| 37 | + |
36 | 38 |
|
37 | 39 | class Meta(ComplexAttribute): |
38 | 40 | """All "meta" sub-attributes are assigned by the service provider (have a "mutability" of "readOnly"), and all of these sub-attributes have a "returned" characteristic of "default". |
@@ -85,7 +87,7 @@ class Meta(ComplexAttribute): |
85 | 87 | """ |
86 | 88 |
|
87 | 89 |
|
88 | | -class Extension(BaseModel): |
| 90 | +class Extension(SchemaObject): |
89 | 91 | @classmethod |
90 | 92 | def to_schema(cls) -> "Schema": |
91 | 93 | """Build a :class:`~scim2_models.Schema` from the current extension class.""" |
@@ -145,13 +147,7 @@ def __new__(cls, name: str, bases: tuple, attrs: dict, **kwargs: Any) -> type: |
145 | 147 | return klass |
146 | 148 |
|
147 | 149 |
|
148 | | -class Resource(BaseModel, Generic[AnyExtension], metaclass=ResourceMetaclass): |
149 | | - schemas: Annotated[list[str], Required.true] |
150 | | - """The "schemas" attribute is a REQUIRED attribute and is an array of |
151 | | - Strings containing URIs that are used to indicate the namespaces of the |
152 | | - SCIM schemas that define the attributes present in the current JSON |
153 | | - structure.""" |
154 | | - |
| 150 | +class Resource(ScimObject, Generic[AnyExtension], metaclass=ResourceMetaclass): |
155 | 151 | # Common attributes as defined by |
156 | 152 | # https://www.rfc-editor.org/rfc/rfc7643#section-3.1 |
157 | 153 |
|
|
0 commit comments