fix: filter out description field in workflow updates (issue #431)

Root Cause:
- n8n recently added a `description` field to workflows
- The field is returned by GET /workflows/:id endpoint
- But PUT /workflows/:id rejects it with "additional properties" error
- Our cleanWorkflowForUpdate() wasn't filtering it out

The Fix:
1. Added `description` to the list of removed fields in cleanWorkflowForUpdate()
2. Added `description` field to Workflow type definition
3. Added test case to verify description field is excluded

Code Review Improvements:
- Removed diagnostic logging code (was only needed for debugging)
- Improved comment accuracy in type definition
- Added comprehensive test coverage for description field

Testing:
- Build succeeds
- New test passes: "should exclude description field for n8n API compatibility"
- All unit tests pass
- Integration tests confirmed fix works with real n8n API

Related: #431

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
This commit is contained in:
czlonkowski
2025-11-20 18:00:39 +01:00
parent f54d8b6caa
commit a78d7404c0
4 changed files with 18 additions and 0 deletions

Binary file not shown.

View File

@@ -140,6 +140,7 @@ export function cleanWorkflowForUpdate(workflow: Workflow): Partial<Workflow> {
// Remove fields that cause API errors
pinData,
tags,
description, // Issue #431: n8n returns this field but rejects it in updates
// Remove additional fields that n8n API doesn't accept
isArchived,
usedCredentials,

View File

@@ -56,6 +56,7 @@ export interface WorkflowSettings {
export interface Workflow {
id?: string;
name: string;
description?: string; // Returned by GET but must be excluded from PUT/PATCH (n8n API limitation, Issue #431)
nodes: WorkflowNode[];
connections: WorkflowConnection;
active?: boolean; // Optional for creation as it's read-only

View File

@@ -367,6 +367,22 @@ describe('n8n-validation', () => {
expect(cleaned.name).toBe('Test Workflow');
});
it('should exclude description field for n8n API compatibility (Issue #431)', () => {
const workflow = {
name: 'Test Workflow',
description: 'This is a test workflow description',
nodes: [],
connections: {},
versionId: 'v123',
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
expect(cleaned).not.toHaveProperty('description');
expect(cleaned).not.toHaveProperty('versionId');
expect(cleaned.name).toBe('Test Workflow');
});
it('should omit settings property when no settings provided (Issue #431)', () => {
const workflow = {
name: 'Test Workflow',