示例#1
0
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
示例#2
0
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