feat: add typeVersion validation to workflow validator (v2.6.1)
- Enhanced workflow validator to enforce typeVersion on versioned nodes - Returns errors for missing typeVersion with suggested version to add - Warns about outdated typeVersion values - Prevents invalid typeVersion (zero, negative, or exceeding maximum) - Added comprehensive test script for typeVersion validation - Helps AI agents avoid common workflow creation mistakes This ensures workflows always use compatible node versions before deployment. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -259,6 +259,46 @@ export class WorkflowValidator {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Validate typeVersion for versioned nodes
|
||||
if (nodeInfo.isVersioned) {
|
||||
// Check if typeVersion is missing
|
||||
if (!node.typeVersion) {
|
||||
result.errors.push({
|
||||
type: 'error',
|
||||
nodeId: node.id,
|
||||
nodeName: node.name,
|
||||
message: `Missing required property 'typeVersion'. Add typeVersion: ${nodeInfo.version || 1}`
|
||||
});
|
||||
}
|
||||
// Check if typeVersion is invalid
|
||||
else if (typeof node.typeVersion !== 'number' || node.typeVersion < 1) {
|
||||
result.errors.push({
|
||||
type: 'error',
|
||||
nodeId: node.id,
|
||||
nodeName: node.name,
|
||||
message: `Invalid typeVersion: ${node.typeVersion}. Must be a positive number`
|
||||
});
|
||||
}
|
||||
// Check if typeVersion is outdated (less than latest)
|
||||
else if (nodeInfo.version && node.typeVersion < nodeInfo.version) {
|
||||
result.warnings.push({
|
||||
type: 'warning',
|
||||
nodeId: node.id,
|
||||
nodeName: node.name,
|
||||
message: `Outdated typeVersion: ${node.typeVersion}. Latest is ${nodeInfo.version}`
|
||||
});
|
||||
}
|
||||
// Check if typeVersion exceeds maximum supported
|
||||
else if (nodeInfo.version && node.typeVersion > nodeInfo.version) {
|
||||
result.errors.push({
|
||||
type: 'error',
|
||||
nodeId: node.id,
|
||||
nodeName: node.name,
|
||||
message: `typeVersion ${node.typeVersion} exceeds maximum supported version ${nodeInfo.version}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Validate node configuration
|
||||
const nodeValidation = this.nodeValidator.validateWithMode(
|
||||
node.type,
|
||||
|
||||
Reference in New Issue
Block a user