(schema: any, args: unknown)
| 15 | const MAX_NAME_LENGTH = 30; |
| 16 | |
| 17 | export const validateFunctionArgs = (schema: any, args: unknown) => { |
| 18 | try { |
| 19 | if (isZodType(schema)) { |
| 20 | schema.parse(args); |
| 21 | } else { |
| 22 | const ajv = new Ajv(); |
| 23 | |
| 24 | addFormats(ajv); |
| 25 | ajv.compile({ |
| 26 | ...schema, |
| 27 | $schema: undefined, |
| 28 | }); |
| 29 | ajv.validate(schema, args); |
| 30 | } |
| 31 | } catch (e: unknown) {} |
| 32 | }; |
| 33 | |
| 34 | export const validateServiceName = (name: string) => { |
| 35 | if (!ALLOWED_NAME_CHARACTERS.test(name)) { |
no test coverage detected