From 2ff477a339ff88c165152ec71df2f8b1c3a721f8 Mon Sep 17 00:00:00 2001 From: Siddhant Rai Date: Mon, 14 Jul 2025 12:53:09 +0530 Subject: [PATCH] feat(agent): enhance validation for agent creation by checking required and invalid fields --- application/api/user/routes.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/api/user/routes.py b/application/api/user/routes.py index 8e3324a2..221cb64e 100644 --- a/application/api/user/routes.py +++ b/application/api/user/routes.py @@ -1264,11 +1264,16 @@ class CreateAgent(Resource): "prompt_id", "agent_type", ] + validate_fields = ["name", "description", "prompt_id", "agent_type"] else: required_fields = ["name"] - missing_fields = validate_required_fields(data, required_fields) + validate_fields = [] + missing_fields = check_required_fields(data, required_fields) + invalid_fields = validate_required_fields(data, validate_fields) if missing_fields: return missing_fields + if invalid_fields: + return invalid_fields image_url, error = handle_image_upload(request, "", user, storage) if error: