本文整理匯總了Python中jsonschema.Draft3Validator.iter_errors方法的典型用法代碼示例。如果您正苦於以下問題:Python Draft3Validator.iter_errors方法的具體用法?Python Draft3Validator.iter_errors怎麽用?Python Draft3Validator.iter_errors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jsonschema.Draft3Validator
的用法示例。
在下文中一共展示了Draft3Validator.iter_errors方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: validate
# 需要導入模塊: from jsonschema import Draft3Validator [as 別名]
# 或者: from jsonschema.Draft3Validator import iter_errors [as 別名]
def validate(nbjson):
"""Checks whether the given notebook JSON conforms to the current
notebook format schema, and returns the list of errors.
"""
# load the schema file
with open(schema_path, 'r') as fh:
schema_json = json.load(fh)
# resolve internal references
schema = resolve_ref(schema_json)
schema = jsonpointer.resolve_pointer(schema, '/notebook')
# count how many errors there are
v = Validator(schema)
errors = list(v.iter_errors(nbjson))
return errors