File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed
Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ const violationTypes = {
3030 AdditionalProperties : 'Additional-Properties' ,
3131 UnknownViolation : 'Unknown-Violation' ,
3232 UnplannedEvent : 'Unplanned-Event' ,
33+ AdvanceRulesViolation : 'Advance-Rules-Violation' ,
3334} ;
3435
3536const supportedEventTypes = {
@@ -227,6 +228,28 @@ async function validate(event) {
227228 } ,
228229 } ;
229230 break ;
231+ case 'minLength' :
232+ case 'maxLength' :
233+ case 'pattern' :
234+ case 'format' :
235+ case 'multipleOf' :
236+ case 'minimum' :
237+ case 'maximum' :
238+ case 'exclusiveMinimum' :
239+ case 'exclusiveMaximum' :
240+ case 'minItems' :
241+ case 'maxItems' :
242+ case 'uniqueItems' :
243+ case 'enum' :
244+ rudderValidationError = {
245+ type : violationTypes . AdvanceRulesViolation ,
246+ message : error . message ,
247+ meta : {
248+ instancePath : error . instancePath ,
249+ schemaPath : error . schemaPath ,
250+ } ,
251+ } ;
252+ break ;
230253 default :
231254 rudderValidationError = {
232255 type : violationTypes . UnknownViolation ,
Original file line number Diff line number Diff line change @@ -266,7 +266,8 @@ const validationErrorsTestCases = [
266266 validationErrors : [
267267 { type : "Datatype-Mismatch" } ,
268268 { type : "Unplanned-Event" } ,
269- { type : "Additional-Properties" }
269+ { type : "Additional-Properties" } ,
270+ { type : "Advance-Rules-Violation" }
270271 ] ,
271272 output : true
272273 } ,
@@ -283,7 +284,8 @@ const validationErrorsTestCases = [
283284 validationErrors : [
284285 { type : "Datatype-Mismatch" } ,
285286 { type : "Unplanned-Event" } ,
286- { type : "Additional-Properties" }
287+ { type : "Additional-Properties" } ,
288+ { type : "Advance-Rules-Violation" }
287289 ] ,
288290 output : true
289291 } ,
Original file line number Diff line number Diff line change @@ -614,7 +614,7 @@ const eventValidationTestCases = [
614614 trackingPlan,
615615 output : [
616616 {
617- type : "Unknown -Violation" ,
617+ type : "Advance-Rules -Violation" ,
618618 message : "must be <= 4" ,
619619 meta : {
620620 instancePath : "/properties/revenue" ,
@@ -665,7 +665,7 @@ const eventValidationTestCases = [
665665 instancePath : "/properties/dateString" ,
666666 schemaPath : "#/properties/properties/properties/dateString/format" ,
667667 } ,
668- type : "Unknown -Violation" ,
668+ type : "Advance-Rules -Violation" ,
669669 }
670670 ]
671671 } ,
You can’t perform that action at this time.
0 commit comments