private static bool Verify(string xsltRule, string content, string metadata, out TestResult result) { string jsonSchema = XsltTransformer.Transform(metadata, xsltRule); try { var jsonSchemaVerifier = new JsonSchemaVerifier(jsonSchema); return(jsonSchemaVerifier.Verify(content, out result)); } catch (Exception e) { if (!ExceptionHelper.IsCatchableExceptionType(e)) { throw; } throw new RuntimeException(e, jsonSchema); } }
private static bool Verify(string xsltRule, string content, string metadata, out TestResult result) { string jsonSchema = XsltTransformer.Transform(metadata, xsltRule); try { var jsonSchemaVerifier = new JsonSchemaVerifier(jsonSchema); return jsonSchemaVerifier.Verify(content, out result); } catch (Exception e) { if (!ExceptionHelper.IsCatchableExceptionType(e)) { throw; } throw new RuntimeException(e, jsonSchema); } }
/// <summary> /// Validates a Json schema against a payload string /// </summary> /// <param name="jschema">The JSon schema</param> /// <param name="payload">The payload string</param> /// <param name="testResult">output parameter of detailed test result</param> /// <returns>Returns true when the payload is validated; otherwise false</returns> public static bool ValidateJson(string jschema, string payload, out RuleEngine.TestResult testResult) { JsonSchemaVerifier verifer = new JsonSchemaVerifier(jschema); return verifer.Verify(payload, out testResult); }