Class JsonSchema
- Namespace
- Newtonsoft.Json.Schema
- Assembly
- Newtonsoft.Json.dll
An in-memory representation of a JSON Schema.
public class JsonSchema
- Inheritance
-
JsonSchema
- Inherited Members
Constructors
JsonSchema()
Initializes a new instance of the JsonSchema class.
public JsonSchema()
Properties
AdditionalProperties
Gets or sets the JsonSchema of additional properties.
public JsonSchema AdditionalProperties { get; set; }
Property Value
- JsonSchema
The JsonSchema of additional properties.
AllowAdditionalProperties
Gets or sets a value indicating whether additional properties are allowed.
public bool AllowAdditionalProperties { get; set; }
Property Value
- bool
true
if additional properties are allowed; otherwise,false
.
Default
Gets or sets the default value.
public JToken Default { get; set; }
Property Value
- JToken
The default value.
Description
Gets or sets the description of the object.
public string Description { get; set; }
Property Value
Disallow
Gets or sets disallowed types.
public JsonSchemaType? Disallow { get; set; }
Property Value
- JsonSchemaType?
The disallow types.
DivisibleBy
Gets or sets a number that the value should be divisble by.
public double? DivisibleBy { get; set; }
Property Value
- double?
A number that the value should be divisble by.
Enum
Gets or sets the a collection of valid enum values allowed.
public IList<JToken> Enum { get; set; }
Property Value
ExclusiveMaximum
Gets or sets a flag indicating whether the value can not equal the number defined by the "maximum" attribute.
public bool? ExclusiveMaximum { get; set; }
Property Value
- bool?
A flag indicating whether the value can not equal the number defined by the "maximum" attribute.
ExclusiveMinimum
Gets or sets a flag indicating whether the value can not equal the number defined by the "minimum" attribute.
public bool? ExclusiveMinimum { get; set; }
Property Value
- bool?
A flag indicating whether the value can not equal the number defined by the "minimum" attribute.
Extends
Gets or sets the extend JsonSchema.
public JsonSchema Extends { get; set; }
Property Value
- JsonSchema
The extended JsonSchema.
Format
Gets or sets the format.
public string Format { get; set; }
Property Value
- string
The format.
Hidden
Gets or sets whether the object is visible to users.
public bool? Hidden { get; set; }
Property Value
- bool?
Id
Gets or sets the id.
public string Id { get; set; }
Property Value
Identity
Gets or sets the identity.
public IList<string> Identity { get; set; }
Property Value
Items
Gets or sets the JsonSchema of items.
public IList<JsonSchema> Items { get; set; }
Property Value
- IList<JsonSchema>
The JsonSchema of items.
Maximum
Gets or sets the maximum.
public double? Maximum { get; set; }
Property Value
- double?
The maximum.
MaximumItems
Gets or sets the maximum number of items.
public int? MaximumItems { get; set; }
Property Value
- int?
The maximum number of items.
MaximumLength
Gets or sets the maximum length.
public int? MaximumLength { get; set; }
Property Value
- int?
The maximum length.
Minimum
Gets or sets the minimum.
public double? Minimum { get; set; }
Property Value
- double?
The minimum.
MinimumItems
Gets or sets the minimum number of items.
public int? MinimumItems { get; set; }
Property Value
- int?
The minimum number of items.
MinimumLength
Gets or sets the minimum length.
public int? MinimumLength { get; set; }
Property Value
- int?
The minimum length.
Options
Gets or sets a collection of options.
public IDictionary<JToken, string> Options { get; set; }
Property Value
- IDictionary<JToken, string>
A collection of options.
Pattern
Gets or sets the pattern.
public string Pattern { get; set; }
Property Value
- string
The pattern.
PatternProperties
Gets or sets the pattern properties.
public IDictionary<string, JsonSchema> PatternProperties { get; set; }
Property Value
- IDictionary<string, JsonSchema>
The pattern properties.
Properties
Gets or sets the JsonSchema of properties.
public IDictionary<string, JsonSchema> Properties { get; set; }
Property Value
- IDictionary<string, JsonSchema>
The JsonSchema of properties.
ReadOnly
Gets or sets whether the object is read only.
public bool? ReadOnly { get; set; }
Property Value
- bool?
Required
Gets or sets whether the object is required.
public bool? Required { get; set; }
Property Value
- bool?
Requires
Gets or sets the required property if this property is present.
public string Requires { get; set; }
Property Value
- string
The required property if this property is present.
Title
Gets or sets the title.
public string Title { get; set; }
Property Value
Transient
Gets or sets whether the object is transient.
public bool? Transient { get; set; }
Property Value
- bool?
Type
Gets or sets the types of values allowed by the object.
public JsonSchemaType? Type { get; set; }
Property Value
- JsonSchemaType?
The type.
Methods
Parse(string)
Load a JsonSchema from a string that contains schema JSON.
public static JsonSchema Parse(string json)
Parameters
Returns
- JsonSchema
A JsonSchema populated from the string that contains JSON.
Parse(string, JsonSchemaResolver)
Parses the specified json.
public static JsonSchema Parse(string json, JsonSchemaResolver resolver)
Parameters
json
stringThe json.
resolver
JsonSchemaResolverThe resolver.
Returns
- JsonSchema
A JsonSchema populated from the string that contains JSON.
Read(JsonReader)
Reads a JsonSchema from the specified JsonReader.
public static JsonSchema Read(JsonReader reader)
Parameters
reader
JsonReaderThe JsonReader containing the JSON Schema to read.
Returns
- JsonSchema
The JsonSchema object representing the JSON Schema.
Read(JsonReader, JsonSchemaResolver)
Reads a JsonSchema from the specified JsonReader.
public static JsonSchema Read(JsonReader reader, JsonSchemaResolver resolver)
Parameters
reader
JsonReaderThe JsonReader containing the JSON Schema to read.
resolver
JsonSchemaResolverThe JsonSchemaResolver to use when resolving schema references.
Returns
- JsonSchema
The JsonSchema object representing the JSON Schema.
ToString()
public override string ToString()
Returns
WriteTo(JsonWriter)
Writes this schema to a JsonWriter.
public void WriteTo(JsonWriter writer)
Parameters
writer
JsonWriterA JsonWriter into which this method will write.
WriteTo(JsonWriter, JsonSchemaResolver)
Writes this schema to a JsonWriter using the specified JsonSchemaResolver.
public void WriteTo(JsonWriter writer, JsonSchemaResolver resolver)
Parameters
writer
JsonWriterA JsonWriter into which this method will write.
resolver
JsonSchemaResolverThe resolver used.