mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-02-06 22:30:25 +00:00
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:
@@ -1871,7 +1871,9 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||||||
if isinstance(annotation, dict):
|
if isinstance(annotation, dict):
|
||||||
# Convert to AnnotationType
|
# Convert to AnnotationType
|
||||||
try:
|
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)
|
annotations_new.append(annotation)
|
||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
logger.error(f"Invalid annotation data: {annotation}. Error: {e}")
|
logger.error(f"Invalid annotation data: {annotation}. Error: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user