Skip to main content
scimschema-logo

ScimSchema

https://github.com/GordonSo/scimschema/workflows/Upload%20Python%20Package/badge.svg

Validate JSon content given a predefined set of SCIM Schemas (in JSON representation format) as specified in SCIM (supporting Python 3+).

Example use case

  1. Install the library via pip:

pip install scimschema
  1. Specify any custom schemas in json format as per the rfc requirement: https://tools.ietf.org/html/rfc7643#section-2

  2. Put the json files under a Python package as per our examples here: https://github.com/GordonSo/scimschema/tree/master/tests/extension (also checkout our __init__() file which is handy for loading the json)

  3. Import the `validate` method from scimschema and pass in json response/request content and the extension schemas to assert its validness

To step through the above in working code, check out this test: test_scim_schema.py.

from scimschema import validate
from . import extension # <- this is the custom schemas define by your: see https://github.com/GordonSo/scimschema/tree/master/tests/extension for example

# A sample schema, like what we'd get from response.get(<scim entity url>).json()
content = {
    "schemas": ["urn:ietf:params:scim:schemas:core2:2.0:Group", "urn:huddle:params:scim:schemas:extension:2.0:SimpleAccount"],
    "id": "2819c223-7f76-453a-919d-413861904646",
    "externalId": 9,
    "meta": {
        "resourceType": "User",
        "created": "2011-08-01T18:29:49.793Z",
        "lastModified": "Invalid date",
        "location": "https://example.com/v2/Users/2819c223...",
        "version": "W\/\"f250dd84f0671c3\""
    }
}
validate(
    data=content,
    extension_schema_definitions=extension.schema
)

>>>    E   _scimschema._model.scim_exceptions.AggregatedScimMultValueAttributeValidationExceptions: Found 1 aggregated exceptions at Scim response:
>>>    E    ScimAttributeValueNotFoundException:
>>>    E             'Single-value attribute:ipRestrictionsEnabled' is required at the following location '['urn:huddle:params:scim:schemas:extension:2.0:Account', 'ipRestrictionsEnabled']' but found '{}'
>>>    !!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!

Features

Support for SCIM 2.0,
  • Validate SCIM Schema definition
    • Validate Model (schema) Id, Name, description, attributes

    • Validate Attribute (schema) Name, Type, Required, Canonical Values, Mutability, Returned, Uniqueness

  • Validate JSON Content against SCIM Schema
    • Validate significant value against Type (Binary, Boolean, Datetime, Decimal, Integer, Reference, String, Complex, MultiValued)

    • Characteristics Required, Canonical Values, Uniqueness

Upcoming features

  • Validate JSON Content for characteristics below:
    • Mutability, Returned

Running the Test Suite

The project requires poetry The project requires pytest to discover tests, and it complies to PEP 517 via Poetry (see pyproject.toml) Github Actions are to run on commit as part of CI and automatic deployments.

Creating new release

Update scimschema/VERSION and pyproject.toml Merge into release branch

Contributing

This project is powered by the QA department at Huddle

The source code is available on GitHub.

Get in touch, via GitHub or otherwise, contributors are also welcome!

Release files for scimschema 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scimschema 0.3.1
File Size Uploaded
scimschema-0.3.1.tar.gz 18.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scimschema 0.3.1
File Interpreter ABI Platform
scimschema-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 43.1 kB

Release files / scimschema-0.3.1.tar.gz

Download URL scimschema-0.3.1.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4a925b3bbc151209421b598e31b5bc9b805f3a53bd34c75794fce4c54675203b
BLAKE2b-256 checksum
How to use checksums
8d0c77103c14a530d2be96e4f6e4695fa5fed72c1058fd975f6c78485cb4808f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.9.5 Linux/5.8.0-1033-azure

Release files / scimschema-0.3.1-py3-none-any.whl

Download URL scimschema-0.3.1-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27bdffe33eacb3c3568b2d1b4a6b5b3e5dca838c8212b89599f87bbcfe2fc911
BLAKE2b-256 checksum
How to use checksums
a4e3f068211c8d180eccf7e495b9374c9a1cdf54759951aa26442949315e2876
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.9.5 Linux/5.8.0-1033-azure

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.2.94

2 release files

0.2.91

2 release files

0.2.89

2 release files

0.2.88

2 release files

0.2.86

2 release files

0.2.85

2 release files

0.2.83

2 release files

0.1.70

1 release file

0.1.69

1 release file

0.1.68

1 release file

0.1.67

1 release file

0.1.55

1 release file

0.1.54

1 release file

0.1.52

1 release file

0.1.47

1 release file

0.1.45

2 release files

0.1.1

1 release file

0.1.0

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page