mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-30 22:23:11 +00:00
fix: address validation improvements from AI agent feedback
- Filter out @version and internal properties from warnings - Deduplicate validation errors (keep most specific message) - Add basic code syntax validation for JavaScript and Python - Check for unbalanced braces/parentheses - Validate Python indentation consistency - Add n8n-specific pattern checks (return statements, input access) - Bump version to 2.4.2 Based on comprehensive AI agent review showing 9.5/10 rating 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -68,6 +68,9 @@ export class EnhancedConfigValidator extends ConfigValidator {
|
||||
// Add operation-specific enhancements
|
||||
this.addOperationSpecificEnhancements(nodeType, config, enhancedResult);
|
||||
|
||||
// Deduplicate errors
|
||||
enhancedResult.errors = this.deduplicateErrors(enhancedResult.errors);
|
||||
|
||||
// Add examples from ExampleGenerator if there are errors
|
||||
if (enhancedResult.errors.length > 0) {
|
||||
this.addExamplesFromGenerator(nodeType, enhancedResult);
|
||||
@@ -202,6 +205,10 @@ export class EnhancedConfigValidator extends ConfigValidator {
|
||||
this.enhanceHttpRequestValidation(config, result);
|
||||
break;
|
||||
|
||||
case 'nodes-base.code':
|
||||
// Code node uses base validation which includes syntax checks
|
||||
break;
|
||||
|
||||
case 'nodes-base.openAi':
|
||||
NodeSpecificValidators.validateOpenAI(context);
|
||||
break;
|
||||
@@ -407,4 +414,31 @@ export class EnhancedConfigValidator extends ConfigValidator {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deduplicate errors based on property and type
|
||||
* Prefers more specific error messages over generic ones
|
||||
*/
|
||||
private static deduplicateErrors(errors: ValidationError[]): ValidationError[] {
|
||||
const seen = new Map<string, ValidationError>();
|
||||
|
||||
for (const error of errors) {
|
||||
const key = `${error.property}-${error.type}`;
|
||||
const existing = seen.get(key);
|
||||
|
||||
if (!existing) {
|
||||
seen.set(key, error);
|
||||
} else {
|
||||
// Keep the error with more specific message or fix
|
||||
const existingLength = (existing.message?.length || 0) + (existing.fix?.length || 0);
|
||||
const newLength = (error.message?.length || 0) + (error.fix?.length || 0);
|
||||
|
||||
if (newLength > existingLength) {
|
||||
seen.set(key, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(seen.values());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user