本文整理汇总了Python中jsonschema.validators.RefResolver.store[""]方法的典型用法代码示例。如果您正苦于以下问题:Python RefResolver.store[""]方法的具体用法?Python RefResolver.store[""]怎么用?Python RefResolver.store[""]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsonschema.validators.RefResolver
的用法示例。
在下文中一共展示了RefResolver.store[""]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_against_qal_schema
# 需要导入模块: from jsonschema.validators import RefResolver [as 别名]
# 或者: from jsonschema.validators.RefResolver import store[""] [as 别名]
def check_against_qal_schema(_ref, _data):
""" Check JSON against given schema
:param _ref: The name of the schema; "resources"
:param _data: The data to be validated
"""
# First create a resolver to resolve the current schema.
_resolver = RefResolver(base_uri="",
handlers={"qal": qal_uri_handler}, referrer=None, cache_remote=True)
_schema = _resolver.resolve(_ref)[1]
_base_ref = urlparse(_ref).scheme + "://" + urlparse(_ref).netloc
if _ref != _base_ref:
_resolver.referrer = _resolver.resolve(_base_ref)[1]
else:
_resolver.referrer = _schema
_resolver.store[""] = _resolver.referrer
Draft4Validator(schema=_schema, resolver=_resolver).validate(_data)