def __init__(self, mapping, resolver, visitor=None, scope=None):
     self.mapping = mapping.copy()
     if '$ref' in self.mapping:
         with resolver.in_scope(scope):
             uri, data = resolver.resolve(self.mapping.pop('$ref'))
             self.mapping.update(data)
     if visitor is None:
         schema = self.mapping.get('schema')
         visitor = SchemaVisitor(schema, resolver, scope=scope)
     self.visitor = visitor
     if self.visitor.parent is None:
         validate_mapping(self.mapping) is not None
Exemple #2
0
 def __init__(self, mapping, resolver, visitor=None, scope=None):
     self.mapping = mapping.copy()
     if '$ref' in self.mapping:
         with resolver.in_scope(scope):
             uri, data = resolver.resolve(self.mapping.pop('$ref'))
             self.mapping.update(data)
     if visitor is None:
         schema = self.mapping.get('schema')
         visitor = SchemaVisitor(schema, resolver, scope=scope)
     self.visitor = visitor
     if self.visitor.parent is None:
         validate_mapping(self.mapping) is not None
Exemple #3
0
 def mapping(self):
     """ Mappings can be given as references only, resolve first. """
     if '$ref' in self._mapping:
         with self.resolver.in_scope(self.scope):
             uri, data = self.resolver.resolve(self._mapping.pop('$ref'))
             self._mapping.update(data)
     if not self._valid:
         self._valid = validate_mapping(self._mapping) is not None
     return self._mapping