def visit(self, ctx: Context, d: dict): # for oneOf (xxx: _case is module global) if _case.when(d, '#/definitions/1'): return ctx.run(None, self.oneOf0.visit, d) if _case.when(d, '#/definitions/3'): return ctx.run(None, self.oneOf1.visit, d) raise ValueError('unexpected value') # todo gentle message
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Person') if self.node is not None: self.node.attach(ctx, d, self) if 'name' in d: ctx.run('name', self.name.visit, d['name']) if 'parents' in d: ctx.run('parents', self.parents.visit, d['parents'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Toplevel') if self.node is not None: self.node.attach(ctx, d, self) if 'definitions' in d: ctx.run('definitions', self.definitions.visit, d['definitions']) if 'properties' in d: ctx.run('properties', self.properties.visit, d['properties'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Toplevel') if self.node is not None: self.node.attach(ctx, d, self) if 'schema' in d: ctx.run('schema', self.schema.visit, d['schema']) if 'points' in d: ctx.run('points', self.points.visit, d['points'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Toplevel') if self.node is not None: self.node.attach(ctx, d, self) if 'father' in d: ctx.run('father', self.father.visit, d['father']) if 'mother' in d: ctx.run('mother', self.mother.visit, d['mother'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Components') if self.node is not None: self.node.attach(ctx, d, self) if 'patternProperties' in d: ctx.run('patternProperties', self.patternProperties.visit, d['patternProperties']) if 'schemas' in d: ctx.run('schemas', self.schemas.visit, d['schemas'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", '_PatternProperties') if self.node is not None: self.node.attach(ctx, d, self) # additionalProperties for k, v in d.items(): if k in self._properties: continue ctx.run(k, self.additional_properties.visit, v)
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", '_Properties') if self.node is not None: self.node.attach(ctx, d, self) # patternProperties for rx, visitor in self._pattern_properties_regexes: for k, v in d.items(): m = rx.search(rx) if m is not None and visitor is not None: ctx.run(k, visitor.visit, v)
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Schema') if self.node is not None: self.node.attach(ctx, d, self) if 'not' in d: ctx.run('not', self.not_.visit, d['not']) # additionalProperties for k, v in d.items(): if k in self._properties: continue logger.warning('unexpected property is found: %r, where=%s', k, self.__class__.__name__)
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Toplevel') if self.node is not None: self.node.attach(ctx, d, self) # patternProperties for rx, visitor in self._pattern_properties_regexes: for k, v in d.items(): m = rx.search(rx) if m is not None and visitor is not None: ctx.run(k, visitor.visit, v) # additionalProperties for k, v in d.items(): if k in self._properties: continue for rx, visitor in self._pattern_properties_regexes: m = rx.search(rx) if m is not None: continue logger.warning('unexpected property is found: %r, where=%s', k, self.__class__.__name__)
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Schema') if self.node is not None: self.node.attach(ctx, d, self) if 'patternProperties' in d: ctx.run('patternProperties', self.patternProperties.visit, d['patternProperties']) if 'properties' in d: ctx.run('properties', self.properties.visit, d['properties']) if 'additionalProperties' in d: ctx.run('additionalProperties', self.additionalProperties.visit, d['additionalProperties'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Toplevel') if self.node is not None: self.node.attach(ctx, d, self) if 'structure' in d: ctx.run('structure', self.structure.visit, d['structure'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'ComplexStructure') if self.node is not None: self.node.attach(ctx, d, self) if 'person' in d: ctx.run('person', self.person.visit, d['person'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Structure') if self.node is not None: self.node.attach(ctx, d, self) if 'xof' in d: ctx.run('xof', self.xof.visit, d['xof'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Discriminator') if self.node is not None: self.node.attach(ctx, d, self) if 'mapping' in d: ctx.run('mapping', self.mapping.visit, d['mapping'])
def _visit(self, ctx: Context, d: dict): logger.debug("visit: %s", 'Schema') if self.node is not None: self.node.attach(ctx, d, self) if 'additionalProperties' in d: ctx.run('additionalProperties', self.additionalProperties.visit, d['additionalProperties']) if 'allOf' in d: ctx.run('allOf', self.allOf.visit, d['allOf']) if 'anyOf' in d: ctx.run('anyOf', self.anyOf.visit, d['anyOf']) if 'default' in d: ctx.run('default', self.default.visit, d['default']) if 'discriminator' in d: ctx.run('discriminator', self.discriminator.visit, d['discriminator']) if 'enum' in d: ctx.run('enum', self.enum.visit, d['enum']) if 'example' in d: ctx.run('example', self.example.visit, d['example']) if 'items' in d: ctx.run('items', self.items.visit, d['items']) if 'not' in d: ctx.run('not', self.not_.visit, d['not']) if 'oneOf' in d: ctx.run('oneOf', self.oneOf.visit, d['oneOf']) if 'properties' in d: ctx.run('properties', self.properties.visit, d['properties']) if 'required' in d: ctx.run('required', self.required.visit, d['required']) # patternProperties for rx, visitor in self._pattern_properties_regexes: for k, v in d.items(): m = rx.search(rx) if m is not None and visitor is not None: ctx.run(k, visitor.visit, v) # additionalProperties for k, v in d.items(): if k in self._properties: continue for rx, visitor in self._pattern_properties_regexes: m = rx.search(rx) if m is not None: continue logger.warning('unexpected property is found: %r, where=%s', k, self.__class__.__name__)