feat: use extra="forbid" in annotation Validations

this can be problematic if many users have additional data in their annotations.
This commit is contained in:
Matthias
2026-02-04 07:14:03 +01:00
parent aa302fe531
commit 6c2a5b460e

View File

@@ -1871,7 +1871,9 @@ class IStrategy(ABC, HyperStrategyMixin):
if isinstance(annotation, dict):
# Convert to AnnotationType
try:
AnnotationTypeTA.validate_python(annotation)
# "forbid" extra fields to catch user errors
# Can be questioned if this creates many problems
AnnotationTypeTA.validate_python(annotation, extra="forbid")
annotations_new.append(annotation)
except ValidationError as e:
logger.error(f"Invalid annotation data: {annotation}. Error: {e}")