-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Issue Description
The documentation on deprecating a field in actuator configuration (https://ibm.github.io/ado/actuators/creating-actuator-classes/#deprecating-a-field-in-your-actuators-custom-configuration) assumes that values will be a dict. However in the case of a read via ado, from a database or from a file, it will be GenericActuatorParameters
How to reproduce
- Add a before validator to an actuators parameters model as per https://ibm.github.io/ado/actuators/creating-actuator-classes/#deprecating-a-field-in-your-actuators-custom-configuration
- Attempt to access any field of the model as a dict in the validator
- Read an existing instance of the actuatorconfiguration using the parameters from the db or a file
Additional information
The reason is
- ActuatorConfigurationResource is the model instantiated from the db with the actuator parameters as the value of config field.
- The type of the config field is GenericActuatorParameters.
- This field is not validated until after the ActuatorConfigurationResource model is initialised at which point the actuator parameters are wrapped in a GenericActuatorParameters model (which can have arbitrary fields).
- Then the actual Actuator is discovered and used to convert the GenericActuatorParameters in
ado/orchestrator/modules/actuators/base.py
Lines 158 to 164 in d3e41ea
def validate_parameters( self, parameters: GenericActuatorParameters ) -> GenericActuatorParameters: """ Validates parameters provided by an actuator configuration. """ return self.parameters_class.model_validate(parameters, from_attributes=True)
* The GenericActuatorParameters is passed to model_validate
We either need to change this code to pass a dict, as the docs suggest, or update the docs.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working