Use RandomDataGenerator.Net 1.0.3.0 (#231)

* Include="RandomDataGenerator.Net" Version="1.0.3"

* UndefinedBindingResult
This commit is contained in:
Stef Heyenrath
2018-11-13 09:49:46 +00:00
committed by GitHub
parent ac2ecd112f
commit 18af7a41d4
9 changed files with 220 additions and 50 deletions

View File

@@ -9,15 +9,15 @@ namespace WireMock.Transformers
{
internal static class HandleBarsJsonPath
{
public static void Register()
public static void Register(IHandlebars handlebarsContext)
{
Handlebars.RegisterHelper("JsonPath.SelectToken", (writer, context, arguments) =>
handlebarsContext.RegisterHelper("JsonPath.SelectToken", (writer, context, arguments) =>
{
(JObject valueToProcess, string jsonpath) = ParseArguments(arguments);
(JObject valueToProcess, string jsonPath) = ParseArguments(arguments);
try
{
var result = valueToProcess.SelectToken(jsonpath);
var result = valueToProcess.SelectToken(jsonPath);
writer.WriteSafeString(result);
}
catch (JsonException)
@@ -26,13 +26,13 @@ namespace WireMock.Transformers
}
});
Handlebars.RegisterHelper("JsonPath.SelectTokens", (writer, options, context, arguments) =>
handlebarsContext.RegisterHelper("JsonPath.SelectTokens", (writer, options, context, arguments) =>
{
(JObject valueToProcess, string jsonpath) = ParseArguments(arguments);
(JObject valueToProcess, string jsonPath) = ParseArguments(arguments);
try
{
var values = valueToProcess.SelectTokens(jsonpath);
var values = valueToProcess.SelectTokens(jsonPath);
if (values != null)
{
options.Template(writer, values.ToDictionary(value => value.Path, value => value));