-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix writing dependencies, add JSchema.ToString settings overload (#202)
- Loading branch information
Showing
9 changed files
with
163 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
Src/Newtonsoft.Json.Schema.Tests/Issues/Issue0200Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
#region License | ||
// Copyright (c) Newtonsoft. All Rights Reserved. | ||
// License: https://raw.github.com/JamesNK/Newtonsoft.Json.Schema/master/LICENSE.md | ||
#endregion | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using Newtonsoft.Json.Linq; | ||
#if DNXCORE50 | ||
using Xunit; | ||
using Test = Xunit.FactAttribute; | ||
using Assert = Newtonsoft.Json.Schema.Tests.XUnitAssert; | ||
#else | ||
using NUnit.Framework; | ||
#endif | ||
|
||
namespace Newtonsoft.Json.Schema.Tests.Issues | ||
{ | ||
[TestFixture] | ||
public class Issue0200Tests : TestFixtureBase | ||
{ | ||
[Test] | ||
public void Test() | ||
{ | ||
// Arrange | ||
string schemaJson = @"{ | ||
""type"": ""object"", | ||
""definitions"": { | ||
""foo"": { | ||
""type"": ""object"", | ||
""properties"": { | ||
""bar"": { | ||
""$ref"": ""#/definitions/bar"" | ||
}, | ||
""baz"": { | ||
""$ref"": ""#/definitions/bar"" | ||
} | ||
} | ||
}, | ||
""bar"": { | ||
""type"": ""string"" | ||
} | ||
}, | ||
""dependencies"": { | ||
""foo"": { | ||
""oneOf"": [ | ||
{ | ||
""properties"": { | ||
""foo"": { | ||
""$ref"": ""#/definitions/foo"" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}"; | ||
|
||
JSchema schema = JSchema.Parse(schemaJson); | ||
|
||
// Act | ||
string serialized = schema.ToString(); | ||
|
||
// Assert | ||
StringAssert.AreEqual(@"{ | ||
""definitions"": { | ||
""foo"": { | ||
""type"": ""object"", | ||
""properties"": { | ||
""bar"": { | ||
""$ref"": ""#/definitions/bar"" | ||
}, | ||
""baz"": { | ||
""$ref"": ""#/definitions/bar"" | ||
} | ||
} | ||
}, | ||
""bar"": { | ||
""type"": ""string"" | ||
} | ||
}, | ||
""type"": ""object"", | ||
""dependencies"": { | ||
""foo"": { | ||
""oneOf"": [ | ||
{ | ||
""properties"": { | ||
""foo"": { | ||
""$ref"": ""#/definitions/foo"" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}", serialized); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"sdk": { | ||
"version": "3.0.100-preview9-013927" | ||
"version": "3.1.100" | ||
} | ||
} |