n8n-nodes-base
Version:
Base nodes of n8n
24 lines (22 loc) • 1.28 kB
JavaScript
/**
* Freshservice Node - Version 1 - Zod Schema
* Discriminator: resource=product, operation=create
*
* Use .parse() for strict validation or .safeParse() for error handling.
*
* Schema helpers (z, expressionSchema, etc.) are passed as parameters
* by the schema-validator, not imported from external files.
*
* @generated - CommonJS JavaScript for runtime loading
*/
module.exports = function getSchema({ parameters, z, expressionSchema, stringOrExpression, numberOrExpression, booleanOrExpression, resourceLocatorValueSchema, resourceMapperValueSchema, filterValueSchema, assignmentCollectionValueSchema, iDataObjectSchema }) {
return z.object({
parameters: z.object({
resource: z.literal('product'),
operation: z.literal('create').default('create'),
assetTypeId: stringOrExpression.optional(),
name: stringOrExpression.optional(),
additionalFields: z.object({ description: stringOrExpression.optional(), manufacturer: stringOrExpression.optional(), mode_of_procurement: z.union([z.literal('Buy'), z.literal('Lease'), z.literal('Both'), expressionSchema]).optional(), status: z.union([z.literal('In Production'), z.literal('In Pipeline'), z.literal('Retired'), expressionSchema]).optional() }).optional(),
}).optional(),
});
};