-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix schema generation of sealed type with extension data (#332)
- Loading branch information
Showing
2 changed files
with
46 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#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; | ||
using Newtonsoft.Json.Schema.Generation; | ||
using Newtonsoft.Json.Serialization; | ||
#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 Issue0331Tests : TestFixtureBase | ||
{ | ||
[Test] | ||
public void Test() | ||
{ | ||
JSchemaGenerator generator = new JSchemaGenerator(); | ||
JSchema schema = generator.Generate(typeof(MyDto)); | ||
|
||
Assert.IsFalse(schema.AllowAdditionalPropertiesSpecified); | ||
} | ||
|
||
public sealed class MyDto | ||
{ | ||
[JsonProperty("foo")] | ||
public string Foo { get; set; } | ||
|
||
[JsonExtensionData] | ||
public IDictionary<string, JToken> ExtensionData { get; set; } | ||
} | ||
} | ||
} |
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