Registry / serialization / scim2-models

scim2-models

JSON →
library0.6.12pypypi✓ verified 82d ago

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-models
INSTALL
IMPORT
SIG · SCIM2-MODELS
S
scim2-models
serializationpythonv0.6.12
Install
3.6s avg
Import
Disk
30MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.12 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 31.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.6s · import 0.000s · 31MB
30MB installed
● package 30MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

User
from scim2_models import User
from scim2_models.resources import User
EnterpriseUser
from scim2_models import EnterpriseUser
BaseModel
from scim2_models import BaseModel

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.

from scim2_models.resources import User from pydantic import ValidationError user_data = { "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "userName": "bjensen@example.com", "id": "2819c223-7f76-453a-919d-413861904646", "name": { "givenName": "Babs", "familyName": "Jensen" }, "emails": [ { "value": "bjensen@example.com", "type": "work", "primary": True } ], "meta": { "resourceType": "User", "created": "2024-04-13T12:00:00Z", "lastModified": "2024-04-13T12:00:00Z", "location": "https://example.com/v2/Users/2819c223-7f76-453a-919d-413861904646" } } try: user = User.model_validate(user_data) print(f"Successfully validated user: {user.user_name}") print(f"User ID: {user.id}") except ValidationError as e: print(f"Validation error: {e}") # You can also create a user directly new_user = User( userName="testuser", emails=[{"value": "test@example.com", "type": "work", "primary": True}] ) print(f"Created new user: {new_user.model_dump_json(indent=2)}")
Debug
Known issues
breakingIn version 0.6.0, the mechanism for defining schema URNs on custom SCIM resource models changed. Resources now define their schema URN with a `__schema__` class variable instead of a `schemas` default value.
fix
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.
affects: >=0.6.0
gotchaThe library is officially marked as '3 - Alpha' status on PyPI. This indicates that the API might still be unstable, and backward-incompatible changes could occur in minor versions without strict adherence to semantic versioning until a stable '1.0' release.
fix
Be prepared for potential API adjustments when upgrading, and consult the changelog for details on each new release.
affects: <1.0.0
gotchaThe library supports context-aware validation (e.g., for creation, query, or replacement operations). This means that validation behavior can differ based on the `context` parameter provided to validation methods. An attribute that is optional during a PUT (replacement) might be required during a POST (creation).
fix
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.
affects: All
Upgrade
Version history
0.6.12latest on PyPI · released Apr 13, 2026
Audit
Dependencies
pydanticrequiredCore dependency for defining and validating SCIM schemas.
Agent activity
33 hits · last 30 days
node
28
OpenAI (training)
2
Resources
scim2-models — pip install scim2-models · libregistry