Browse Source

refac: external tool validation

Timothy Jaeryang Baek 1 week ago
parent
commit
39675434f6
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/lib/components/AddToolServerModal.svelte

+ 10 - 3
src/lib/components/AddToolServerModal.svelte

@@ -98,9 +98,16 @@
 			return;
 		}
 
-		if (path === '') {
-			toast.error($i18n.t('Please enter a valid path'));
-			return;
+		if (['openapi', ''].includes(type)) {
+			if (spec_type === 'json' && spec === '') {
+				toast.error($i18n.t('Please enter a valid JSON spec'));
+				return;
+			}
+
+			if (spec_type === 'url' && path === '') {
+				toast.error($i18n.t('Please enter a valid path'));
+				return;
+			}
 		}
 
 		if (direct) {