给定预定义模式的跨域身份管理(SCIM)响应系统的验证器
scimschema的Python项目详细描述
scimschema
根据SCIM(支持python 3+)中指定的预定义scim模式集(json表示格式),验证json内容。
示例用例
看看这个test_scim_schema.py。
fromscimschemaimportvalidatefrom.importextension# 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:Found1aggregatedexceptionsatScimresponse:>>>EScimAttributeValueNotFoundException:>>>E'Single-value attribute:ipRestrictionsEnabled'isrequiredatthefollowinglocation'['urn:huddle:params:scim:schemas:extension:2.0:Account', 'ipRestrictionsEnabled']'butfound'{}'>>>!!!!!!!!!!!!!!!!!!!Interrupted:1errorsduringcollection!!!!!!!!!!!!!!!!!!!
功能
- 支持SCIM 2.0,
- 验证SCIM架构定义
- 验证模型(模式)ID、名称、描述、属性
- 验证属性(模式)名称、类型、必需、规范值、可变性、返回、唯一性
- 根据scim模式验证json内容
- 根据类型(binary、boolean、datetime、decimal、integer、reference、string、complex、multivalued)验证有效值
- 所需特征、规范值、唯一性
即将推出的功能
- Validate JSON Content for characteristics below:
- Mutability, Returned