Home ErrorMessages Class
ErrorMessages Class
Cancel

ErrorMessages Class

Namespace: Json.Schema

Inheritance: ErrorMessages 🡒 object

Manages error messages returned by built-in keywords.

Remarks

Default messages are provided by culture-specific resource files.

Many messages support tokens in the format [[foo]]. Each message will specify the tokens it supports.

Properties

NameTypeSummary
ConststringGets or sets the error message for Json.Schema.ConstKeyword.
ContainsTooFewstringGets or sets the error message for Json.Schema.ContainsKeyword when there are too few matching items.
ContainsTooManystringGets or sets the error message for Json.Schema.ContainsKeyword when there are too many matching items.
CultureCultureInfoGets or sets a culture to use for error messages. Default is System.Globalization.CultureInfo.CurrentCulture.
DependentRequiredstringGets or sets the error message for Json.Schema.DependentRequiredKeyword.
DependentSchemasstringGets or sets the error message for Json.Schema.DependentSchemasKeyword.
EnumstringGets or sets the error message for Json.Schema.EnumKeyword.
ExclusiveMaximumstringGets or sets the error message for Json.Schema.ExclusiveMaximumKeyword.
ExclusiveMinimumstringGets or sets the error message for Json.Schema.ExclusiveMinimumKeyword.
FalseSchemastringGets or sets the error message for the “false” schema.
FormatstringGets or sets the error message for the Json.Schema.FormatKeyword.
FormatWithDetailstringGets or sets the error message for the Json.Schema.FormatKeyword with additional information from the format validation.
MaximumstringGets or sets the error message for Json.Schema.MinimumKeyword.
MaxItemsstringGets or sets the error message for Json.Schema.MaxItemsKeyword.
MaxLengthstringGets or sets the error message for Json.Schema.MaxLengthKeyword.
MaxPropertiesstringGets or sets the error message for Json.Schema.MaxPropertiesKeyword.
MetaSchemaValidationstringGets or sets the error message for when the schema cannot be validated against the meta-schema.
MinimumstringGets or sets the error message for Json.Schema.MinimumKeyword.
MinItemsstringGets or sets the error message for Json.Schema.MinItemsKeyword.
MinLengthstringGets or sets the error message for Json.Schema.MinLengthKeyword.
MinPropertiesstringGets or sets the error message for Json.Schema.MinPropertiesKeyword.
MultipleOfstringGets or sets the error message for Json.Schema.MultipleOfKeyword.
OneOfstringGets or sets the error message for Json.Schema.OneOfKeyword.
PatternstringGets or sets the error message for Json.Schema.PatternKeyword.
RequiredstringGets or sets the error message for Json.Schema.RequiredKeyword.
TypestringGets or sets the error message for Json.Schema.TypeKeyword.
UniqueItemsstringGets or sets the error message for Json.Schema.UniqueItemsKeyword.
UnknownFormatstringGets or sets the error message for an unknown format.
UnknownVocabulariesstringGets or sets the error message for when a vocabulary is unknown but required.

Methods

GetConst(CultureInfo culture)

Gets the error message for Json.Schema.ConstKeyword for a specific culture.

Declaration

1
public static string GetConst(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[value]] - the value in the schema

GetContainsTooFew(CultureInfo culture)

Gets the error message for Json.Schema.ContainsKeyword for a specific culture.

Declaration

1
public static string GetContainsTooFew(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the number of matching items provided in the JSON instance
  • [[minimum]] - the lower limit specified in the schema

GetContainsTooMany(CultureInfo culture)

Gets the error message for Json.Schema.ContainsKeyword for a specific culture.

Declaration

1
public static string GetContainsTooMany(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the number of matching items provided in the JSON instance
  • [[maximum]] - the upper limit specified in the schema

GetDependentRequired(CultureInfo culture)

Gets the error message for Json.Schema.DependentRequiredKeyword for a specific culture.

Declaration

1
public static string GetDependentRequired(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[missing]] - the value in the schema

GetDependentSchemas(CultureInfo culture)

Gets the error message for Json.Schema.DependentSchemasKeyword for a specific culture.

Declaration

1
public static string GetDependentSchemas(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[value]] - the value in the schema

GetEnum(CultureInfo culture)

Gets the error message for Json.Schema.EnumKeyword for a specific culture.

Declaration

1
public static string GetEnum(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the value provided in the JSON instance
  • [[values]] - the available values in the schema

The default messages are static and do not use these tokens as enum values may be any JSON type and could be quite large. They are provided to support custom messages.

GetExclusiveMaximum(CultureInfo culture)

Gets the error message for Json.Schema.ExclusiveMaximumKeyword for a specific culture.

Declaration

1
public static string GetExclusiveMaximum(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the value provided in the JSON instance
  • [[limit]] - the upper limit in the schema

GetExclusiveMinimum(CultureInfo culture)

Gets the error message for Json.Schema.ExclusiveMinimumKeyword for a specific culture.

Declaration

1
public static string GetExclusiveMinimum(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the value provided in the JSON instance
  • [[limit]] - the lower limit in the schema

GetFormat(CultureInfo culture)

Gets the error message for Json.Schema.FormatKeyword for a specific culture.

Declaration

1
public static string GetFormat(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[format]] - the format key

GetFormatWithDetail(CultureInfo culture)

Gets the error message for Json.Schema.FormatKeyword for a specific culture.

Declaration

1
public static string GetFormatWithDetail(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[format]] - the format key
  • [[detail]] - the detail

GetMaximum(CultureInfo culture)

Gets the error message for Json.Schema.MinimumKeyword for a specific culture.

Declaration

1
public static string GetMaximum(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the value provided in the JSON instance
  • [[limit]] - the upper limit in the schema

GetMaxItems(CultureInfo culture)

Gets the error message for Json.Schema.MaxItemsKeyword for a specific culture.

Declaration

1
public static string GetMaxItems(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the number of items provided in the JSON instance
  • [[limit]] - the upper limit specified in the schema

GetMaxLength(CultureInfo culture)

Gets the error message for Json.Schema.MaxLengthKeyword for a specific culture.

Declaration

1
public static string GetMaxLength(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the length of the JSON string
  • [[limit]] - the upper limit specified in the schema

GetMaxProperties(CultureInfo culture)

Gets the error message for Json.Schema.MaxPropertiesKeyword for a specific culture.

Declaration

1
public static string GetMaxProperties(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the number of properties provided in the JSON instance
  • [[limit]] - the upper limit specified in the schema

GetMetaSchemaValidation(CultureInfo culture)

Gets or sets the error message for when the schema cannot be validated against the meta-schema.

Declaration

1
public static string GetMetaSchemaValidation(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[uri]] - the URI of the meta-schema

GetMinimum(CultureInfo culture)

Gets the error message for Json.Schema.MinimumKeyword for a specific culture.

Declaration

1
public static string GetMinimum(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfo 

Returns

Remarks

Available tokens are:

  • [[received]] - the value provided in the JSON instance
  • [[limit]] - the lower limit in the schema

GetMinItems(CultureInfo culture)

Gets the error message for Json.Schema.MinItemsKeyword for a specific culture.

Declaration

1
public static string GetMinItems(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the number of items provided in the JSON instance
  • [[limit]] - the lower limit specified in the schema

GetMinLength(CultureInfo culture)

Gets the error message for Json.Schema.MinLengthKeyword for a specific culture.

Declaration

1
public static string GetMinLength(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the length of the JSON string
  • [[limit]] - the lower limit specified in the schema

GetMinProperties(CultureInfo culture)

Gets the error message for Json.Schema.MinPropertiesKeyword for a specific culture.

Declaration

1
public static string GetMinProperties(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the number of properties provided in the JSON instance
  • [[limit]] - the lower limit specified in the schema

GetMultipleOf(CultureInfo culture)

Gets the error message for Json.Schema.MultipleOfKeyword for a specific culture.

Declaration

1
public static string GetMultipleOf(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the value provided in the JSON instance
  • [[divisor]] - the required divisor

GetOneOf(CultureInfo culture)

Gets the error message for Json.Schema.OneOfKeyword for a specific culture.

Declaration

1
public static string GetOneOf(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[count]] - the number of subschemas that passed validation

GetPattern(CultureInfo culture)

Gets the error message for Json.Schema.PatternKeyword for a specific culture.

Declaration

1
public static string GetPattern(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[pattern]] - the regular expression

GetRequired(CultureInfo culture)

Gets the error message for Json.Schema.RequiredKeyword for a specific culture.

Declaration

1
public static string GetRequired(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[missing]] - the properties missing from the JSON instance

GetType(CultureInfo culture)

Gets the error message for Json.Schema.TypeKeyword for a specific culture.

Declaration

1
public static string GetType(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[received]] - the type of value provided in the JSON instance
  • [[expected]] - the type(s) required by the schema

GetUniqueItems(CultureInfo culture)

Gets the error message for Json.Schema.UniqueItemsKeyword for a specific culture.

Declaration

1
public static string GetUniqueItems(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[duplicates]] - the indices of duplicate pairs as a comma-delimited list of “(x, y)” items

GetUnknownFormat(CultureInfo culture)

Gets the error message for an unknown format.

Declaration

1
public static string GetUnknownFormat(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[format]] - the format key

GetUnknownVocabularies(CultureInfo culture)

Gets or sets the error message for when a vocabulary is unknown but required.

Declaration

1
public static string GetUnknownVocabularies(CultureInfo culture)
ParameterTypeDescription
cultureCultureInfoThe culture to retrieve.

Returns

Remarks

Available tokens are:

  • [[vocabs]] - the URI IDs of the missing vocabularies as a comma-delimited list

ReplaceToken(this string message, string name, object value)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, object value)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valueobjectThe value.

Returns

The detokenized string.

ReplaceToken(this string message, string name, int value)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, int value)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valueintThe value.

Returns

The detokenized string.

ReplaceToken(this string message, string name, uint value)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, uint value)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valueuintThe value.

Returns

The detokenized string.

ReplaceToken(this string message, string name, decimal value)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, decimal value)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valuedecimalThe value.

Returns

The detokenized string.

ReplaceToken(this string message, string name, string value)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, string value)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valuestringThe value.

Returns

The detokenized string.

ReplaceToken(this string message, string name, string[] value)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, string[] value)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valuestring[]The value.

Returns

The detokenized string.

ReplaceToken(this string message, string name, Dictionary<string, string[]> value)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, Dictionary<string, string[]> value)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valueDictionary<string, string[]>The value.

Returns

The detokenized string.

ReplaceToken(this string message, string name, JsonNode value)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, JsonNode value)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valueJsonNodeThe value.

Returns

The detokenized string.

ReplaceToken(this string message, string name, T value, JsonTypeInfo<T> typeInfo)

Replaces tokens in the form of [[token]] with a specified value, serialized as JSON.

Declaration

1
public static string ReplaceToken(this string message, string name, T value, JsonTypeInfo<T> typeInfo)
ParameterTypeDescription
messagestringThe message template.
namestringThe token name (without brackets)
valueTThe value.
typeInfoJsonTypeInfo<T>A JsonTypeInfo that matches value.

Returns

The detokenized string.

Contents