-Added IJsonLineInfo. Implemented by JsonTextReader, JsonTokenReader, JsonValidatingReader, JToken
-Added line details to JsonTextReader exception messages and JsonValidatingReader errors -Change JsonSchemaGenerator to disable additional properties on sealed classes -Fixed JsonSchemaGenerator to not output enum values and options for flag enums
This commit is contained in:
@@ -32,6 +32,9 @@ namespace Newtonsoft.Json.Schema
|
||||
/// </summary>
|
||||
public class JsonSchemaException : Exception
|
||||
{
|
||||
public int LineNumber { get; private set; }
|
||||
public int LinePosition { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JsonSchemaException"/> class.
|
||||
/// </summary>
|
||||
@@ -59,5 +62,12 @@ namespace Newtonsoft.Json.Schema
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
internal JsonSchemaException(string message, Exception innerException, int lineNumber, int linePosition)
|
||||
: base(message, innerException)
|
||||
{
|
||||
LineNumber = lineNumber;
|
||||
LinePosition = linePosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -253,8 +253,11 @@ namespace Newtonsoft.Json.Schema
|
||||
CurrentSchema.Properties.Add(mapping.MappingName, propertySchema);
|
||||
}
|
||||
}
|
||||
|
||||
if (type.IsSealed)
|
||||
CurrentSchema.AllowAdditionalProperties = false;
|
||||
}
|
||||
else if (CurrentSchema.Type == JsonSchemaType.Integer && type.IsEnum)
|
||||
else if (CurrentSchema.Type == JsonSchemaType.Integer && type.IsEnum && !type.IsDefined(typeof(FlagsAttribute), true))
|
||||
{
|
||||
CurrentSchema.Enum = new List<JToken>();
|
||||
CurrentSchema.Options = new Dictionary<JToken, string>();
|
||||
|
||||
Reference in New Issue
Block a user