def _validate_internal_items(
        self,
        value: Any,
        name: str,
        variable_path: tuple | None = None,
    ):
        """Validate internal items of a data structure."""
        variable_path = variable_path or tuple()
        variable_path += (name,)
        if isinstance(value, list):
            for i, item in enumerate(value):
                _item_path = tuple(variable_path)
                if isinstance(item, dict):
                    _item_path += (f"{i}", "{name}")
                    _validator_location = ".".join(_item_path)
                    data = item
                else:
                    _item_path += (f"{i}",)
                    _validator_location = ".".join(_item_path)
                    data = {"<item>": item}

                for validator in self.items_validators:
                    # avoid mutating a reusable validator
                    if not validator.names:
                        _validator = deepcopy(validator)
                        _validator.names = ("<item>",)
                    else:
                        _validator = validator

                    for k, v in _validator.default_messages.items():
                        _validator.messages[k] = v.replace(
                            "{name}", _validator_location
                        )

                    _validator.validate(data, variable_path=_item_path)

        elif isinstance(value, dict):
            _validator_location = ".".join(variable_path)
            for validator in self.items_validators:
                for k, v in validator.default_messages.items():
                    validator.messages[k] = v.replace(
                        "{name}", _validator_location + ".{name}"
                    )
                validator.validate(
                    value, only=validator.names, variable_path=variable_path
                )
Validate internal items of a data structure.
dynaconf/validator.py