Spaces:
Building
Building
Update flare-ui/src/app/dialogs/api-edit-dialog/api-edit-dialog.component.ts
Browse files
flare-ui/src/app/dialogs/api-edit-dialog/api-edit-dialog.component.ts
CHANGED
@@ -311,24 +311,31 @@ export default class ApiEditDialogComponent implements OnInit {
|
|
311 |
|
312 |
replaceVariablesForValidation(jsonStr: string): string {
|
313 |
let processed = jsonStr;
|
314 |
-
|
315 |
-
//
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
});
|
328 |
-
|
329 |
-
// Diğer tüm değişkenler için string değer
|
330 |
-
processed = processed.replace(/\{\{[^}]+\}\}/g, '"placeholder"');
|
331 |
-
|
332 |
return processed;
|
333 |
}
|
334 |
|
|
|
311 |
|
312 |
replaceVariablesForValidation(jsonStr: string): string {
|
313 |
let processed = jsonStr;
|
314 |
+
|
315 |
+
// Tüm {{...}} template değişkenlerini uygun placeholder ile değiştir
|
316 |
+
processed = processed.replace(/\{\{([^}]+)\}\}/g, (match, variablePath) => {
|
317 |
+
// Değişken tipini tahmin et
|
318 |
+
if (variablePath.includes('variables.')) {
|
319 |
+
const varName = variablePath.split('.').pop()?.toLowerCase() || '';
|
320 |
+
|
321 |
+
// Bilinen sayısal değişkenler
|
322 |
+
const numericVars = ['count', 'passenger_count', 'timeout_seconds', 'retry_count', 'amount', 'price', 'quantity', 'age', 'id'];
|
323 |
+
const booleanVars = ['enabled', 'published', 'is_active', 'confirmed', 'canceled', 'deleted', 'required'];
|
324 |
+
|
325 |
+
if (numericVars.some(v => varName.includes(v))) {
|
326 |
+
return '1';
|
327 |
+
} else if (booleanVars.some(v => varName.includes(v))) {
|
328 |
+
return 'true';
|
329 |
+
} else {
|
330 |
+
// String olarak ele al
|
331 |
+
return '"placeholder"';
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
// Auth token'lar ve config değerleri her zaman string
|
336 |
+
return '"placeholder"';
|
337 |
});
|
338 |
+
|
|
|
|
|
|
|
339 |
return processed;
|
340 |
}
|
341 |
|