mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat: Option to skip validation in getNodeParameter (#14726)
This commit is contained in:
@@ -18,6 +18,7 @@ import { ApplicationError, ExpressionError, NodeConnectionTypes } from 'n8n-work
|
||||
|
||||
import { describeCommonTests } from './shared-tests';
|
||||
import { ExecuteContext } from '../execute-context';
|
||||
import * as validateUtil from '../utils/validate-value-against-schema';
|
||||
|
||||
describe('ExecuteContext', () => {
|
||||
const testCredentialType = 'testCredential';
|
||||
@@ -177,6 +178,18 @@ describe('ExecuteContext', () => {
|
||||
const parameter = executeContext.getNodeParameter('testParameter', 0);
|
||||
expect(parameter).toEqual([{ name: undefined, value: undefined }]);
|
||||
});
|
||||
|
||||
it('should not validate parameter if skipValidation in options', () => {
|
||||
const validateSpy = jest.spyOn(validateUtil, 'validateValueAgainstSchema');
|
||||
|
||||
executeContext.getNodeParameter('testParameter', 0, '', {
|
||||
skipValidation: true,
|
||||
});
|
||||
|
||||
expect(validateSpy).not.toHaveBeenCalled();
|
||||
|
||||
validateSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getCredentials', () => {
|
||||
|
||||
@@ -406,6 +406,8 @@ export abstract class NodeExecutionContext implements Omit<FunctionsBase, 'getCr
|
||||
});
|
||||
}
|
||||
|
||||
if (options?.skipValidation) return returnData;
|
||||
|
||||
// Validate parameter value if it has a schema defined(RMC) or validateType defined
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
returnData = validateValueAgainstSchema(
|
||||
|
||||
Reference in New Issue
Block a user