def evaluate(self, instance: JSON, scope: Scope) -> None: if contains := scope.sibling("contains"): if (contains_annotation := contains.annotations.get("contains")) and \ len(contains_annotation.value) > self.json: scope.fail( instance, 'The array has too many elements matching the ' f'"contains" subschema (maximum {self.json})')
def evaluate(self, instance: JSON, scope: Scope) -> None: if (items := scope.sibling("items")) and \ (items_annotation := items.annotations.get("items")) and \ type(items_annotation.value) is int: annotation = None for index, item in enumerate(instance[items_annotation.value + 1:]): annotation = True self.json.evaluate(item, scope) if scope.valid: scope.annotate(instance, "additionalItems", annotation)
def evaluate(self, instance: JSON, scope: Scope) -> None: if contains := scope.sibling("contains"): contains_count = len(contains_annotation.value) \ if (contains_annotation := contains.annotations.get("contains")) \ else 0 valid = contains_count >= self.json if valid and not contains.valid: max_contains = scope.sibling("maxContains") if not max_contains or max_contains.valid: contains.errors.clear() if not valid: scope.fail( instance, 'The array has too few elements matching the ' f'"contains" subschema (minimum {self.json})')
def evaluate(self, instance: JSON, scope: Scope) -> None: evaluated_names = set() if (properties := scope.sibling("properties")) and \ (properties_annotation := properties.annotations.get("properties")):
def evaluate(self, instance: JSON, scope: Scope) -> None: if (prefix_items := scope.sibling("prefixItems")) and \ (prefix_items_annotation := prefix_items.annotations.get("prefixItems")):
def evaluate(self, instance: JSON, scope: Scope) -> None: if (if_ := scope.sibling("if")) and not if_.valid: self.json.evaluate(instance, scope)
def evaluate(self, instance: JSON, scope: Scope) -> None: if scope.sibling("contentMediaType"): super().evaluate(instance, scope) else: scope.discard()