Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2011-06-01 11:12:46 +0400
committerJamesNK <james@newtonking.com>2011-06-01 11:12:46 +0400
commit857d72530c3ec05f034ad8ea88faf8a89b7850e9 (patch)
treea1f988cd14588a12a5c664f86864aa2faf63283b
parent3997b601ffba23f71368c625eb930fba5e82e65c (diff)
-Change reading schema references to ignore additional content after the $ref property
-rw-r--r--Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs2
-rw-r--r--Src/Newtonsoft.Json/Properties/AssemblyInfo.cs2
-rw-r--r--Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs10
3 files changed, 11 insertions, 3 deletions
diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
index d26198c..96fae98 100644
--- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
@@ -41,5 +41,5 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.0.2.0")]
#if !PocketPC
-[assembly: AssemblyFileVersion("4.0.2.13728")]
+[assembly: AssemblyFileVersion("4.0.2.13801")]
#endif
diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
index 9712e8b..4a96e92 100644
--- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
+++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
@@ -110,7 +110,7 @@ using System.Security;
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.0.2.0")]
#if !PocketPC
-[assembly: AssemblyFileVersion("4.0.2.13728")]
+[assembly: AssemblyFileVersion("4.0.2.13801")]
#endif
[assembly: CLSCompliant(true)]
diff --git a/Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs b/Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs
index 830adbe..7a140d6 100644
--- a/Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs
+++ b/Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs
@@ -97,7 +97,15 @@ namespace Newtonsoft.Json.Schema
if (propertyName == JsonSchemaConstants.ReferencePropertyName)
{
string id = (string)_reader.Value;
- _reader.Read();
+
+ // skip to the end of the current object
+ while (_reader.Read() && _reader.TokenType != JsonToken.EndObject)
+ {
+ if (_reader.TokenType == JsonToken.StartObject)
+ throw new Exception("Found StartObject within the schema reference with the Id '{0}'"
+ .FormatWith(CultureInfo.InvariantCulture, id));
+ }
+
JsonSchema referencedSchema = _resolver.GetSchema(id);
if (referencedSchema == null)
throw new Exception("Could not resolve schema reference for Id '{0}'.".FormatWith(CultureInfo.InvariantCulture, id));