Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions apps/sim/serializer/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,35 @@ describe('Serializer', () => {
}).toThrow('Test Jina Block is missing required fields: API Key')
})

it.concurrent('should skip validation for disabled blocks', () => {
const serializer = new Serializer()

// Create a disabled block with a missing user-only required field
const disabledBlockWithMissingField: any = {
id: 'test-block',
type: 'jina',
name: 'Disabled Jina Block',
position: { x: 0, y: 0 },
subBlocks: {
url: { value: 'https://example.com' },
apiKey: { value: null }, // Missing user-only required field
},
outputs: {},
enabled: false, // Block is disabled
}

// Should NOT throw error because the block is disabled
expect(() => {
serializer.serializeWorkflow(
{ 'test-block': disabledBlockWithMissingField },
[],
{},
undefined,
true
)
}).not.toThrow()
})

it.concurrent('should not throw error when all user-only required fields are present', () => {
const serializer = new Serializer()

Expand Down
5 changes: 5 additions & 0 deletions apps/sim/serializer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ export class Serializer {
blockConfig: any,
params: Record<string, any>
) {
// Skip validation if the block is disabled
if (block.enabled === false) {
return
}

// Skip validation if the block is used as a trigger
if (
block.triggerMode === true ||
Expand Down