SHARE
TWEET

Untitled

a guest May 25th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import jsonschema
  2. import yaml
  3. from handofcats import as_command
  4.  
  5.  
  6. @as_command
  7. def run(*, src: str, schema: str) -> None:
  8.     with open(schema) as rf:
  9.         schema = yaml.load(rf)
  10.     with open(src) as rf:
  11.         data = yaml.load(rf)
  12.     jsonschema.Draft4Validator.check_schema(schema)
  13.     validator = jsonschema.Draft4Validator(schema)
  14.     for err in validator.iter_errors(data):
  15.         print("E", err)
  16.         print(vars(err))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top