You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[0.7.0] - 2026-09-05
--------------------
Added
^^^^^
- :func:`~scim2_models.get_model_by_schema` and :func:`~scim2_models.get_model_by_payload` module functions.
They look models up by schema, accept any sequence of :class:`~scim2_models.ScimObject` subclasses,
and reflect the input types in the returned type.
- :class:`~scim2_models.ScimObject` and ``AnyScimObject`` are exposed in the public API, so that downstream projects can annotate values that are either resources or messages.
- :class:`~scim2_models.ExtensibleStringEnum` is exposed in the public API, so custom models
can define string attributes that suggest canonical values without restricting them.
- :meth:`~scim2_models.BaseModel.model_validate_json` takes a ``scim_ctx`` parameter, like the
other validation and serialization methods, so JSON payloads can be validated without being
decoded first. :issue:`150`
Changed
^^^^^^^
- ``model_dump`` and ``model_dump_json`` are defined on :class:`~scim2_models.BaseModel` instead of
:class:`~scim2_models.ScimObject`, so every model is dumped in a SCIM context by default.
Complex attributes dumped on their own use their SCIM attribute names:
``Name(family_name="Doe").model_dump()`` returns ``{"familyName": "Doe"}``
instead of ``{"family_name": "Doe"}``.
- :meth:`~scim2_models.BaseModel.model_dump` with ``scim_ctx=None`` returns the native pydantic
dump, ``None`` values included, as its documentation states. Pass ``exclude_none=True`` to get
the former output.
- :meth:`~scim2_models.Resource.replace` does not mark the fields it copies from the original
resource as set anymore, so ``model_fields_set`` only holds the attributes asserted by the
client, as defined by :rfc:`7644` §3.5.1.
- Attributes suggesting :rfc:`7643` canonical values accept values outside of their canonical
set, as :rfc:`7643` §2.3.1 only allows service providers to restrict them. This covers the
``type`` attribute of :class:`~scim2_models.Email`, :class:`~scim2_models.PhoneNumber`,
:class:`~scim2_models.Im`, :class:`~scim2_models.Photo`, :class:`~scim2_models.Address` and
:class:`~scim2_models.AuthenticationScheme`.
:issue:`34`
- ``str()`` on those attributes returns the SCIM value instead of the enum representation:
``str(Email.Type.work)`` returns ``"work"`` instead of ``"Type.work"``.
- Canonical values are matched case-insensitively, as :rfc:`7643` §2.2 makes those attributes
case-insensitive: ``Email(type="WORK").type`` is ``Email.Type.work``.
- The JSON schema of those attributes advertises the canonical values as ``examples`` instead of
a restrictive ``enum``.
- The ``schemas`` attribute of SCIM payloads is built from the model definition on
serialization, as it describes the serialized document rather than the object. It holds what
a peer asserted, and is empty when a payload omitted it, so the omission stays visible in
``model_fields_set``. Objects built by the caller are still filled, as the model they are
built from asserts their type.
- Resources omitting their ``schemas`` attribute are read instead of being rejected, which
covers the partial responses of :rfc:`7644` §3.4.3. Their type comes from the
:class:`~scim2_models.ListResponse` parameter, so a response holding several resource types
still cannot decide the type of an unlabelled resource. :issue:`20`
- A ``schemas`` attribute that does not contain the model base schema is rejected whatever the
validation context, as an object cannot contradict the model it is an instance of. It used to
be accepted without a SCIM context.
- The ``schemas`` attribute is not subject to attribute filtering anymore, as :rfc:`7643` §3
requires it in every representation. It lost its :attr:`~scim2_models.Returned.always`
annotation, which :rfc:`7643` does not define for it, and which the filtering exemption
replaces.
Fixed
^^^^^
- ``reference`` and ``binary`` attributes are case-exact, unless a schema explicitly states otherwise. :rfc:`7643` §2.3.6 and §2.3.7, `erratum 6001 <https://www.rfc-editor.org/errata/eid6001>`_
- :class:`~scim2_models.ResourceType` ``endpoint`` is case-exact. :rfc:`7643` `erratum 8475 <https://www.rfc-editor.org/errata/eid8475>`_
- :class:`~scim2_models.GroupMember` and :class:`~scim2_models.GroupMembership` ``value`` are case-exact, as they hold resource ``id`` values. :rfc:`7643` §3.1, in the spirit of `erratum 8472 <https://www.rfc-editor.org/errata/eid8472>`_
- :meth:`~scim2_models.Resource.from_schema` no longer crashes on ``reference`` attributes missing the optional ``referenceTypes``, and reads them as :class:`~scim2_models.URI` references.
- Looking a model up by schema no longer crashes when the model list mixes resources with messages such as :class:`~scim2_models.ListResponse`.
- Check recursively extensions' replace constraints.
- The ``readOnly``, ``immutable`` and ``required`` constraints of a PATCH operation are checked
against the attribute its path resolves to, instead of against a literal field name match.
They used to be skipped whenever the two differed, so ``userName`` could be removed and a
path spelled ``GROUPS`` could write to a ``readOnly`` attribute, :rfc:`7643` §2.1 making
attribute names case-insensitive.
Removed
^^^^^^^
- ``Error.make_*_error()`` class methods, deprecated in 0.6.0. Use the matching
:class:`~scim2_models.SCIMException` subclass and its ``to_error()`` method instead.
- The ``ExternalReference`` and ``URIReference`` aliases, deprecated in 0.6.0. Use
:class:`~scim2_models.External` and :class:`~scim2_models.URI` instead.
- The ``Reference[Literal["X"]]`` syntax, deprecated in 0.6.0. Use ``Reference["X"]`` instead.
- Defining a model schema with a ``schemas`` default value, deprecated in 0.6.0. Use
``__schema__ = URN("...")`` instead. Note that ``__schema__`` only accepts valid URNs, while
the removed syntax silently ignored invalid ones.
Deprecated
^^^^^^^^^^
- ``Resource.get_by_schema`` and ``Resource.get_by_payload`` are deprecated in favor of
:func:`~scim2_models.get_model_by_schema` and :func:`~scim2_models.get_model_by_payload`.
Their ``resource_types`` parameter is named ``models`` in the new functions.
They will be removed in 0.8.0.
Performance
^^^^^^^^^^^
- Cached commonly used metadata of fields to ``__scim_info__``.
- Collapsed all scim context validators in :class:`~scim2_models.BaseModel` to one model validator.
- Collapsed serialization to one model serializer in :class:`~scim2_models.BaseModel`.
- Moved ``model_dump`` and ``model_dump_json`` to :class:`~scim2_models.BaseModel`.
- Cached ``_normalize_attribute_name``.
- Simplified ``normalize_attribute_names``.