async def validation_exception_handler(request, exc: pydantic.v1.ValidationError) -> JSONResponse:
    """Catch pydantic v1 validation errors and rewrite as an InvalidArgError whilst keeping error messages from the ValidationError."""
    error_messages = [{
        'loc': error.get('loc', ''),
        'msg': error.get('msg', ''),
        'type': error.get('type', '')
    } for error in exc.errors()]

    body = {
        "message": json.dumps(error_messages),
        "code": InvalidArgError.code,
        "type": InvalidArgError.error_type,
        "link": InvalidArgError.link
    }
    return JSONResponse(content=body, status_code=InvalidArgError.status_code)
Catch pydantic v1 validation errors and rewrite as an InvalidArgError whilst keeping error messages from the ValidationError.
src/marqo/tensor_search/api.py