-Change reading schema references to ignore additional content after the $ref property
This commit is contained in:
@@ -41,5 +41,5 @@ using System.Runtime.InteropServices;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("4.0.2.0")]
|
[assembly: AssemblyVersion("4.0.2.0")]
|
||||||
#if !PocketPC
|
#if !PocketPC
|
||||||
[assembly: AssemblyFileVersion("4.0.2.13728")]
|
[assembly: AssemblyFileVersion("4.0.2.13801")]
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ using System.Security;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("4.0.2.0")]
|
[assembly: AssemblyVersion("4.0.2.0")]
|
||||||
#if !PocketPC
|
#if !PocketPC
|
||||||
[assembly: AssemblyFileVersion("4.0.2.13728")]
|
[assembly: AssemblyFileVersion("4.0.2.13801")]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
[assembly: CLSCompliant(true)]
|
[assembly: CLSCompliant(true)]
|
||||||
|
|||||||
@@ -97,7 +97,15 @@ namespace Newtonsoft.Json.Schema
|
|||||||
if (propertyName == JsonSchemaConstants.ReferencePropertyName)
|
if (propertyName == JsonSchemaConstants.ReferencePropertyName)
|
||||||
{
|
{
|
||||||
string id = (string)_reader.Value;
|
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);
|
JsonSchema referencedSchema = _resolver.GetSchema(id);
|
||||||
if (referencedSchema == null)
|
if (referencedSchema == null)
|
||||||
throw new Exception("Could not resolve schema reference for Id '{0}'.".FormatWith(CultureInfo.InvariantCulture, id));
|
throw new Exception("Could not resolve schema reference for Id '{0}'.".FormatWith(CultureInfo.InvariantCulture, id));
|
||||||
|
|||||||
Reference in New Issue
Block a user