from typing import List
from typing import Dict
from typing import Any


def get_error_messages_by_fields(
    errors: List[Dict[str, Any]],
) -> Dict[str, str]:
    """Getting validation errors by fields from pydantic ValidationError"""
    errors_by_fields = {error["loc"][0]: error["msg"] for error in errors}
    return {
        field_name: f"{field_name.capitalize()} {error_message}"
        for field_name, error_message in errors_by_fields.items()
    }