-Clean up
This commit is contained in:
@@ -28,6 +28,7 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -356,7 +357,7 @@ namespace Newtonsoft.Json.Bson
|
||||
{
|
||||
case State.ObjectStart:
|
||||
{
|
||||
SetToken(JsonToken.PropertyName, "$ref");
|
||||
SetToken(JsonToken.PropertyName, JsonTypeReflector.RefPropertyName);
|
||||
_bsonReaderState = BsonReaderState.ReferenceRef;
|
||||
return true;
|
||||
}
|
||||
@@ -381,7 +382,7 @@ namespace Newtonsoft.Json.Bson
|
||||
{
|
||||
if (_bsonReaderState == BsonReaderState.ReferenceRef)
|
||||
{
|
||||
SetToken(JsonToken.PropertyName, "$id");
|
||||
SetToken(JsonToken.PropertyName, JsonTypeReflector.IdPropertyName);
|
||||
_bsonReaderState = BsonReaderState.ReferenceId;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
@@ -760,13 +761,13 @@ namespace Newtonsoft.Json
|
||||
if (!ReadInternal())
|
||||
throw JsonReaderException.Create(this, "Unexpected end when reading bytes.");
|
||||
|
||||
if (Value.ToString() == "$type")
|
||||
if (Value.ToString() == JsonTypeReflector.TypePropertyName)
|
||||
{
|
||||
ReadInternal();
|
||||
if (Value != null && Value.ToString().StartsWith("System.Byte[]"))
|
||||
{
|
||||
ReadInternal();
|
||||
if (Value.ToString() == "$value")
|
||||
if (Value.ToString() == JsonTypeReflector.ValuePropertyName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
@@ -194,7 +195,7 @@ namespace Newtonsoft.Json.Schema
|
||||
throw JsonException.Create(token, token.Path, "Expected object while parsing schema object, got {0}.".FormatWith(CultureInfo.InvariantCulture, token.Type));
|
||||
|
||||
JToken referenceToken;
|
||||
if (schemaObject.TryGetValue(JsonSchemaConstants.ReferencePropertyName, out referenceToken))
|
||||
if (schemaObject.TryGetValue(JsonTypeReflector.RefPropertyName, out referenceToken))
|
||||
{
|
||||
JsonSchema deferredSchema = new JsonSchema();
|
||||
deferredSchema.DeferredReference = (string)referenceToken;
|
||||
|
||||
@@ -63,8 +63,6 @@ namespace Newtonsoft.Json.Schema
|
||||
public const string OptionValuePropertyName = "value";
|
||||
public const string OptionLabelPropertyName = "label";
|
||||
|
||||
public const string ReferencePropertyName = "$ref";
|
||||
|
||||
public static readonly IDictionary<string, JsonSchemaType> JsonSchemaTypeMapping = new Dictionary<string, JsonSchemaType>
|
||||
{
|
||||
{ "string", JsonSchemaType.String },
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
@@ -52,7 +53,7 @@ namespace Newtonsoft.Json.Schema
|
||||
if (schema.Id != null && _resolver.GetSchema(schema.Id) != null)
|
||||
{
|
||||
_writer.WriteStartObject();
|
||||
_writer.WritePropertyName(JsonSchemaConstants.ReferencePropertyName);
|
||||
_writer.WritePropertyName(JsonTypeReflector.RefPropertyName);
|
||||
_writer.WriteValue(schema.Id);
|
||||
_writer.WriteEndObject();
|
||||
}
|
||||
|
||||
@@ -1948,10 +1948,10 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
{
|
||||
switch (memberName)
|
||||
{
|
||||
case "$type":
|
||||
case "$id":
|
||||
case "$ref":
|
||||
case "$values":
|
||||
case JsonTypeReflector.IdPropertyName:
|
||||
case JsonTypeReflector.RefPropertyName:
|
||||
case JsonTypeReflector.TypePropertyName:
|
||||
case JsonTypeReflector.ArrayValuesPropertyName:
|
||||
reader.Skip();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user