scim2-models is a Python library providing Pydantic models for SCIM (System for Cross-domain Identity Management) schemas, specifically RFC7643 and RFC7644. It facilitates the serialization and validation of SCIM2 payloads using native Python objects. The library includes features like context-aware validation and dynamic schema extensions, serving as a foundational block for building SCIM2 servers and clients. The current version is 0.6.12, and it is actively maintained with frequent releases.
pip install scim2-modelsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to validate an existing SCIM User payload against the `User` model and how to construct a new `User` object directly. The `model_validate` method from Pydantic is used for parsing dictionary data, and `model_dump_json` for serialization.
If you have custom SCIM resource models, update them to use `__schema__ = ["urn:ietf:params:scim:schemas:core:2.0:User"]` (or your specific URN) as a class variable instead of a default value for a 'schemas' field.
Be prepared for potential API adjustments when upgrading, and consult the changelog for details on each new release.
Always consider the SCIM operation context when validating payloads. If validation errors occur unexpectedly, verify that the `context` parameter (if used) correctly reflects the intended SCIM operation.