aea.configurations.validation
Implementation of the configuration validation.
make_
jsonschema_
base_
uri
make_jsonschema_base_uri(base_uri_path: Path) -> str
Make the JSONSchema base URI, cross-platform.
Arguments:
base_uri_path
: the path to the base directory.
Returns:
the string in URI form.
ExtraPropertiesError Objects
class ExtraPropertiesError(ValueError)
Extra properties exception.
__
str__
| __str__() -> str
Get string representation of the object.
__
repr__
| __repr__() -> str
Get string representation of the object.
CustomTypeChecker Objects
class CustomTypeChecker(TypeChecker)
Custom type checker to handle env variables.
is_
type
| is_type(instance, type) -> bool
Check is instance of type.
own_
additional_
properties
own_additional_properties(validator, aP, instance, schema) -> Iterator
Additional properties validator.
ConfigValidator Objects
class ConfigValidator()
Configuration validator implementation.
__
init__
| __init__(schema_filename: str, env_vars_friendly: bool = False) -> None
Initialize the parser for configuration files.
Arguments:
schema_filename
: the path to the JSON-schema file in 'aea/configurations/schemas'.
split_
component_
id_
and_
config
| @staticmethod
| split_component_id_and_config(component_index: int, component_configuration_json: Dict) -> ComponentId
Split component id and configuration.
Arguments:
component_index
: the position of the component configuration in the agent config file..component_configuration_json
: the JSON object to process.
Returns:
the component id and the configuration object.
Raises:
ValueError
: if the component id cannot be extracted.
validate_
component_
configuration
| @classmethod
| validate_component_configuration(cls, component_id: ComponentId, configuration: Dict, env_vars_friendly: bool = False) -> None
Validate the component configuration of an agent configuration file.
This check is to detect inconsistencies in the specified fields.
Arguments:
component_id
: the component id.configuration
: the configuration dictionary.env_vars_friendly
: bool, if set True, will not raise errors over the env variable definitions.
Returns:
None
Raises:
ValueError
: if the configuration is not valid.
validate
| validate(json_data: Dict) -> None
Validate a JSON object against the right JSON schema.
Arguments:
json_data
: the JSON data.
Returns:
None.
validate_
agent_
components_
configuration
| validate_agent_components_configuration(component_configurations: Dict) -> None
Validate agent component configurations overrides.
Arguments:
component_configurations
:
Returns:
None
required_
fields
| @property
| required_fields() -> List[str]
Get the required fields.
Returns:
list of required fields.
validate_
data_
with_
pattern
validate_data_with_pattern(data: dict, pattern: dict, excludes: Optional[List[Tuple[str]]] = None, skip_env_vars: bool = False) -> List[str]
Validate data dict with pattern dict for attributes present and type match.
Arguments:
pattern
: dict with pattern to check overexcludes
: list of tuples of str of paths to be skipped during the checkskip_env_vars
: is set True will not check data type over env variables.
Returns:
list of str with error descriptions
filter_
data
filter_data(base: Any, updates: Any) -> Any
Return difference in values or SAME_MARK
object if values are the same.