Skip to content
This repository has been archived by the owner on Feb 15, 2021. It is now read-only.

Commit

Permalink
rebased on master
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis committed Mar 6, 2020
1 parent 2d9ed82 commit 167f750
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions Manatee.Json.Tests.Benchmark/SchemaPerformance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ private static void _NewtonDeserializeAndValidate(string dataString, string sche

_manateeWatch.Reset();
_manateeWatch.Start();
JSchema schema = JSchema.Parse(schemaString);
var schema = JSchema.Parse(schemaString);

JObject json = JObject.Parse(dataString);
var json = JObject.Parse(dataString);
var result = json.IsValid(schema);

_manateeWatch.Stop();

}
}
}
3 changes: 2 additions & 1 deletion Manatee.Json.Tests/JsonOptionsTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Manatee.Json.Tests.Common;
using NUnit.Framework;

namespace Manatee.Json.Tests
Expand Down Expand Up @@ -379,7 +380,7 @@ int PrintValue(int value)
var log = JsonOptions.Log;
try
{
JsonOptions.Log = new OptionsConfigurator.ConsoleLog();
JsonOptions.Log = new ConsoleLog();
JsonOptions.Log?.Verbose($"changing storedValue to {PrintValue(4)}");

Assert.AreEqual(4, storedValue);
Expand Down
8 changes: 3 additions & 5 deletions Manatee.Json/Schema/JsonSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,21 +317,19 @@ internal SchemaValidationResults Validate(SchemaValidationContext context)
if (context.BaseUri != null && context.BaseUri.OriginalString.EndsWith("#"))
context.BaseUri = new Uri(context.BaseUri.OriginalString.TrimEnd('#'), UriKind.RelativeOrAbsolute);

var nestedResults = new List<SchemaValidationResults>();

if (refKeyword != null && !context.Root.SupportedVersions.HasFlag(JsonSchemaVersion.Draft2019_09))
return refKeyword.Validate(context);

var nestedResults = new List<SchemaValidationResults>();

foreach (var keyword in this.OrderBy(k => k.ValidationSequence))
{
Log.Schema($"Processing `{keyword.Name}`");
Log.Schema(() => $"Processing `{keyword.Name}`");
var localResults = keyword.Validate(context);
Log.Schema($"`{keyword.Name}` complete: {(localResults.IsValid ? "valid" : "invalid")}");
Log.Schema(() => $"`{keyword.Name}` complete: {(localResults.IsValid ? "valid" : "invalid")}");
if (JsonSchemaOptions.OutputFormat == SchemaValidationOutputFormat.Flag && !localResults.IsValid)
{
Log.Schema("Found fail condition with flag output enabled; halting validation early.");
Log.Schema(() => "Found fail condition with flag output enabled; halting validation early.");
return new SchemaValidationResults {IsValid = false};
}
nestedResults.Add(localResults);
Expand Down

0 comments on commit 167f750

Please sign in to comment.