{"id":10090,"library":"pydantic-scim","title":"Pydantic SCIM","description":"Pydantic-SCIM provides Pydantic models that strictly adhere to the SCIM (System for Cross-domain Identity Management) specification. It allows developers to define, validate, and serialize SCIM resources like Users and Groups, simplifying integration with SCIM-compliant identity providers. The library currently supports Pydantic v1.x.","status":"active","version":"0.0.8","language":"en","source_language":"en","source_url":"https://github.com/hartenfels/pydantic-scim","tags":["pydantic","scim","identity","authentication","schema","validation"],"install":[{"cmd":"pip install pydantic-scim","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core dependency for defining data models, strictly requires Pydantic v1.x (<2.0.0).","package":"pydantic","optional":false}],"imports":[{"symbol":"User","correct":"from pydantic_scim import User"},{"symbol":"Group","correct":"from pydantic_scim import Group"},{"symbol":"ListResponse","correct":"from pydantic_scim import ListResponse"}],"quickstart":{"code":"from pydantic_scim import User\n\n# Create a SCIM User object adhering to the SCIM Core Schema\nuser = User(\n    schemas=[\"urn:ietf:params:scim:schemas:core:2.0:User\"],\n    userName=\"bjensen\",\n    name={\n        \"givenName\": \"Barbara\",\n        \"familyName\": \"Jensen\"\n    },\n    emails=[\n        {\n            \"value\": \"bjensen@example.com\",\n            \"type\": \"work\",\n            \"primary\": True\n        }\n    ],\n    active=True,\n    externalId=\"employee-id-123\"\n)\n\n# Serialize the user object to JSON (using Pydantic v1 .json() method)\nprint(user.json(indent=2))","lang":"python","description":"Demonstrates how to instantiate a SCIM User object and serialize it to JSON, following the required SCIM schema fields. Note the use of `user.json()` for Pydantic v1 serialization."},"warnings":[{"fix":"Ensure Pydantic v1.x is installed: `pip install 'pydantic<2.0.0'` or uninstall Pydantic v2 (`pip uninstall pydantic`) before installing Pydantic v1 and pydantic-scim.","message":"pydantic-scim is only compatible with Pydantic v1.x. Installing it with Pydantic v2.x will lead to import errors, validation failures, or unexpected behavior.","severity":"breaking","affected_versions":"All versions of pydantic-scim (0.0.1 - 0.0.8) are strictly `pydantic<2.0.0`."},{"fix":"Always consult the SCIM specification (RFC 7643) for required fields and data types, or refer to the `pydantic-scim` source for model definitions. Ensure all mandatory fields are present.","message":"SCIM schemas are very strict. Missing required fields (e.g., `schemas`, `userName` for User) or providing incorrect data types will result in Pydantic `ValidationError`.","severity":"gotcha","affected_versions":"All"},{"fix":"Use the exact `camelCase` attribute names as defined in the SCIM specification when initializing models (e.g., `userName`, not `user_name`). pydantic-scim models reflect the SCIM spec directly.","message":"SCIM attribute names are case-sensitive and must match the specification exactly (e.g., `userName`, `givenName`, `familyName`). Python's convention often uses `snake_case`, but SCIM uses `camelCase`.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Downgrade Pydantic to version 1.x: `pip uninstall pydantic && pip install 'pydantic<2.0.0'`.","cause":"Attempting to use pydantic-scim with Pydantic v2. This error specifically arises because Pydantic v2 changed how type aliases are handled.","error":"TypeError: 'TypeAliasType' object is not subscriptable"},{"fix":"Ensure all mandatory SCIM attributes are provided and correctly typed. For `User`, the `schemas` field is always required and should include `\"urn:ietf:params:scim:schemas:core:2.0:User\"`.","cause":"A required SCIM field (in this case, `schemas`) was omitted when instantiating a SCIM model, or an invalid value was provided.","error":"pydantic.error_wrappers.ValidationError: 1 validation error for User\\nschemas\\n  field required (type=value_error.missing)"},{"fix":"For Pydantic v1 models, use `user.json()` to serialize to JSON, or `user.dict()` to get a dictionary representation.","cause":"Attempting to use a Pydantic v2 method (`model_dump_json`) on a model defined with Pydantic v1.","error":"AttributeError: 'User' object has no attribute 'model_dump_json'"}]}