Show / Hide Table of Contents

Class JsonSchemaOptions

Defines options associated with JSON Schema.

Inheritance
System.Object
JsonSchemaOptions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Manatee.Json.Schema
Assembly: Manatee.Json.dll
Syntax
public class JsonSchemaOptions

Constructors

| Improve this Doc View Source

JsonSchemaOptions()

Creates a new instance of the JsonSchemaOptions class.

Declaration
public JsonSchemaOptions()
| Improve this Doc View Source

JsonSchemaOptions(JsonSchemaOptions)

Creates a new instance of the JsonSchemaOptions class.

Declaration
public JsonSchemaOptions(JsonSchemaOptions source)
Parameters
Type Name Description
JsonSchemaOptions source

Properties

| Improve this Doc View Source

AllowUnknownFormats

Gets or sets whether unknown string formats are permitted. If disabled and an unknown format is found, the system will throw a JsonSerializationException while loading the schema. The default is true.

Declaration
public bool AllowUnknownFormats { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Default

Default options used by schema.

Declaration
public static JsonSchemaOptions Default { get; }
Property Value
Type Description
JsonSchemaOptions
| Improve this Doc View Source

DefaultBaseUri

Defines a default base URI for root schemas that use a relative URI for their $id. The default is manatee://json-schema/.

Declaration
public Uri DefaultBaseUri { get; set; }
Property Value
Type Description
System.Uri
| Improve this Doc View Source

DefaultProcessingVersion

Gets or sets a default draft version to use in case a schema can be determined to support multiple drafts. Default is latest to earliest.

Declaration
public List<JsonSchemaVersion> DefaultProcessingVersion { get; set; }
Property Value
Type Description
System.Collections.Generic.List<JsonSchemaVersion>
| Improve this Doc View Source

Download

Gets and sets a method used to download online schema.

Declaration
public static Func<string, string> Download { get; set; }
Property Value
Type Description
System.Func<System.String, System.String>
| Improve this Doc View Source

LogMetaSchemaValidation

Gets or sets whether meta-schema validation is enabled. Default is false.

Declaration
public bool LogMetaSchemaValidation { get; set; }
Property Value
Type Description
System.Boolean
Remarks

A schema is validated against the meta-schemas the first time it is used to validate an instance. This is done to determine the specific draft that the schema supports. Logging for this can be quite verbose, but if you want this to be logged, you can enable this feature.

| Improve this Doc View Source

OutputFormat

Gets or sets the output verbosity. The default is Flag.

Declaration
public SchemaValidationOutputFormat OutputFormat { get; set; }
Property Value
Type Description
SchemaValidationOutputFormat
| Improve this Doc View Source

RefResolution

Determines whether siblings of $ref keywords are processed. This also affects how $ref is resolved when adjacent to an $id keyword when a specific draft cannot be identified. The default is ProcessSiblingKeywords to be consistent with the latest draft, 2019-09.

Declaration
public RefResolutionStrategy RefResolution { get; set; }
Property Value
Type Description
RefResolutionStrategy
Remarks

As of draft 2019-09, keywords are allowed to be adjacent to $ref. This means that an adjacent $id keyword will now change the base URI whereas in prior drafts it would not since adjacent keywords were to be ignored.

When Manatee.Json cannot determine the draft a particular schema is using (determined via the $schema keyword or the selection of keywords being used), this option will determine the behavior for resolving URIs.

| Improve this Doc View Source

ValidateFormatKeyword

Gets or sets whether the "format" schema keyword should be validated. The default is true.

Declaration
public bool ValidateFormatKeyword { get; set; }
Property Value
Type Description
System.Boolean

Methods

| Improve this Doc View Source

IgnoreErrorsForChildren(JsonPointer)

Ignores error and annotation collection for children of specific schema locations.

Declaration
public void IgnoreErrorsForChildren(JsonPointer location)
Parameters
Type Name Description
JsonPointer location
Remarks

This may help improve performance. There may be cases where it would be sufficient to only report on the immediate error rather than all child errors. An example of this may be a keyword like oneOf at a specific location, where the client may only want a single error that says, "4 of the 10 subschemas passed validation, but only 1 was expected."

| Improve this Doc View Source

IgnoreErrorsForChildren<T>()

Ignores error and annotation collection for children of specific keywords.

Declaration
public void IgnoreErrorsForChildren<T>()
    where T : IJsonSchemaKeyword
Type Parameters
Name Description
T

The keyword type to ignore.

Remarks

This may help improve performance. There may be cases where it would be sufficient to only report on the immediate error rather than all child errors. An example of this may be a keyword like oneOf, where the client may only want a single error that says, "4 of the 10 subschemas passed validation, but only 1 was expected."

| Improve this Doc View Source

ShouldReportChildErrors(IJsonSchemaKeyword, SchemaValidationContext)

Checks whether child errors and annotations should be reported. Should be called during validation.

Declaration
public bool ShouldReportChildErrors(IJsonSchemaKeyword keyword, SchemaValidationContext context)
Parameters
Type Name Description
IJsonSchemaKeyword keyword

The keyword currently executing validation.

SchemaValidationContext context

The validation context.

Returns
Type Description
System.Boolean

true if child errors should be included in the error; false if the result should only contain the immediate error.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX