diff --git a/anta/models.py b/anta/models.py index 1c9c174a0..bab439642 100644 --- a/anta/models.py +++ b/anta/models.py @@ -450,7 +450,6 @@ def __init__( self.instance_commands: list[AntaCommand] = [] self.result: TestResult = TestResult.model_construct(name=device.name, test=self.name, categories=self.categories, description=self.description) self._init_inputs(inputs) - self.result.inputs = self.inputs if self.result.result == AntaTestStatus.UNSET: self._init_commands(eos_data) @@ -479,6 +478,7 @@ def _init_inputs(self, inputs: dict[str, Any] | AntaTest.Input | None) -> None: if res_ow.description: self.result.description = res_ow.description self.result.custom_field = res_ow.custom_field + self.result.inputs = self.inputs def _init_commands(self, eos_data: list[dict[Any, Any] | str] | None) -> None: """Instantiate the `instance_commands` instance attribute from the `commands` class attribute. diff --git a/anta/result_manager/models.py b/anta/result_manager/models.py index 682962adb..318a3accf 100644 --- a/anta/result_manager/models.py +++ b/anta/result_manager/models.py @@ -10,7 +10,7 @@ from enum import Enum from typing import Any -from pydantic import BaseModel, InstanceOf, SerializeAsAny, SkipValidation +from pydantic import BaseModel, InstanceOf, SerializeAsAny class AntaTestStatus(str, Enum): @@ -99,7 +99,7 @@ class AtomicTestResult(BaseTestResult): _parent: TestResult description: str - inputs: SkipValidation[SerializeAsAny[InstanceOf[BaseModel]]] | None = None + inputs: SerializeAsAny[InstanceOf[BaseModel]] | None = None result: AntaTestStatus = AntaTestStatus.UNSET messages: list[str] = [] @@ -157,7 +157,7 @@ class TestResult(BaseTestResult): test: str categories: list[str] description: str - inputs: SkipValidation[SerializeAsAny[InstanceOf[BaseModel]]] | None = None # A TestResult inputs can be None in case of inputs validation error + inputs: SerializeAsAny[InstanceOf[BaseModel]] | None = None # A TestResult inputs can be None in case of inputs validation error custom_field: str | None = None result: AntaTestStatus = AntaTestStatus.UNSET messages: list[str] = []