# Validators

## Actions

Validate root `actions` and individual `action` Schemas

curator.validators.actions.root()

  Return a valid `Schema` definition which is a dictionary with `actions` `Required` to be the root key with another dictionary as the value.

curator.validators.actions.structure(data, location)

  Return a valid `Schema` definition which tests `data`, which is ostensibly an individual action dictionary. If it is a `valid_action()`, then it will `update()` the base `Schema` with other options, based on the what the value of `data['action']` is.

  Parameters:

    - data (dict) – The configuration dictionary, or sub-dictionary, being validated

    - location (str) – A string to report which configuration sub-block is being tested.

  Returns:

    A `Schema` object

curator.validators.actions.valid_action()

  Return a valid `Schema` definition which is that the value of key `action` is `Required` to be `In` the value returned by `all_actions()`.

## Options

Set up voluptuous Schema defaults for various actions

curator.validators.options.action_specific(action)
  Parameters:

    action (str) – The name of an action

  Returns:

    A `list` containing one or more `Optional` or `Required` options from `option_defaults`, defining acceptable values for each for the given `action`

  Return type:

    list

curator.validators.options.get_schema(action)

  Return a `Schema` of acceptable options and their default values as returned by `action_specific()`, passing along the value of `action`.

  Parameters:

    action (str) – The name of an action

  Returns:

    A valid `Schema` of the options for `action`

## Filter Functions

Functions validating the `filter` Schema of an `action`

curator.validators.filter_functions.filterstructure()

  Return a `Schema` object that uses the return value from `structural_filter_elements()` to populate acceptable values and updates/merges the Schema object with the return value from `filtertype()`

  Returns:

    A `Schema` object

curator.validators.filter_functions.filtertype()

  Return a `Schema` object that uses `all_filtertypes()` to populate acceptable values

  Returns:

    A `Schema` object

curator.validators.filter_functions.singlefilter(action, data)

  Return a `Schema` object that is created using the return value from `filtertype()` to create a local variable `ftype`. The values from `action` and `data` are used to update `ftype` based on matching function names in `filtertypes`.

  `structural_filter_elements()` to populate acceptable values and updates/merges the Schema object with the return value from `filtertype()`

  Parameters:

    - action (str) – The Curator action name

    - data – The filter block of the action

  Returns:

    A `Schema` object

curator.validators.filter_functions.validfilters(action, location=None)

  Validate the filters in a list