File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,17 @@ func ValidateRequestSchema(
9797
9898 compiler := jsonschema .NewCompiler ()
9999 _ = compiler .AddResource ("requestBody.json" , strings .NewReader (string (jsonSchema )))
100- jsch , _ := compiler .Compile ("requestBody.json" )
100+ jsch , err := compiler .Compile ("requestBody.json" )
101+ if err != nil {
102+ validationErrors = append (validationErrors , & errors.ValidationError {
103+ ValidationType : helpers .RequestBodyValidation ,
104+ ValidationSubType : helpers .Schema ,
105+ Message : err .Error (),
106+ Reason : "Failed to compile the request body for validation." ,
107+ Context : string (renderedSchema ),
108+ })
109+ return false , validationErrors
110+ }
101111
102112 // validate the object against the schema
103113 scErrs := jsch .Validate (decodedObj )
You can’t perform that action at this time.
0 commit comments