Skip to content

Instantly share code, notes, and snippets.

View dlutton's full-sized avatar

Daniel Lutton dlutton

  • Lumin Digital
  • Los Angeles, CA
View GitHub Profile
@kratsg
kratsg / example.py
Created April 2, 2020 18:52
python-jsonschema recursive RefResolver class
>>> import jsonschema
>>> resolver = jsonschema.RefResolver(base_uri='https://scikit-hep.org/pyhf/schemas/1.0.0/', referrer='workspace.json')
>>> rec_resolver = RecursiveRefResolver(base_uri='https://scikit-hep.org/pyhf/schemas/1.0.0/', referrer='workspace.json')
>>> resolver.resolve('https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json')
('https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json',
{'$schema': 'http://json-schema.org/draft-06/schema#',
'$id': 'https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json',
'$ref': 'defs.json#/definitions/workspace'})
>>> rec_resolver.resolve('https://scikit-hep.org/pyhf/schemas/1.0.0/workspace.json')
{'$schema': 'http://json-schema.org/draft-06/schema#',