Skip to content

bug: documentation for actuator upgrade is incorrect #212

@michael-johnston

Description

@michael-johnston

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

  1. 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
  2. Attempt to access any field of the model as a dict in the validator
  3. 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
    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

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions