Home SchemaKeywordRegistry Class
SchemaKeywordRegistry Class
Cancel

SchemaKeywordRegistry Class

Namespace: Json.Schema

Inheritance: SchemaKeywordRegistry 🡒 object

Manages which keywords are known by the system.

Remarks

Because the deserialization process relies on keywords being registered, this class cannot be an instance class like the other registries in this library. Therefore keywords are registered for all schemas.

Methods

GetImplementationType(string keyword)

Gets the implementation for a given keyword name.

Declaration

1
public static Type GetImplementationType(string keyword)
ParameterTypeDescription
keywordstringThe keyword name.

Returns

The keyword type, if registered; otherwise null.

Keyword(this Type keywordType)

Gets the keyword string.

Declaration

1
public static string Keyword(this Type keywordType)
ParameterTypeDescription
keywordTypeTypeThe keyword type.

Returns

The keyword string.

Keyword(this IJsonSchemaKeyword keyword)

Gets the keyword string.

Declaration

1
public static string Keyword(this IJsonSchemaKeyword keyword)
ParameterTypeDescription
keywordIJsonSchemaKeywordThe keyword.

Returns

The keyword string.

Priority(this IJsonSchemaKeyword keyword)

Gets the keyword priority.

Declaration

1
public static long Priority(this IJsonSchemaKeyword keyword)
ParameterTypeDescription
keywordIJsonSchemaKeywordThe keyword.

Returns

The priority.

Register()

Registers a new keyword type.

Declaration

1
public static void Register()

Register(JsonSerializerContext typeContext)

Registers a new keyword type.

Declaration

1
public static void Register(JsonSerializerContext typeContext)
ParameterTypeDescription
typeContextJsonSerializerContextJsonTypeInfo for the keyword type

RegisterNullValue(T nullKeyword)

Registers a null-value for a keyword.

Declaration

1
public static void RegisterNullValue(T nullKeyword)
ParameterTypeDescription
nullKeywordT 

Remarks

This is important for keywords that accept null, like default and const. Without this step, the serializer will skip keywords that have nulls.

SupportsVersion(this IJsonSchemaKeyword keyword, SpecVersion version)

Determines if a keyword is declared by a given version of the JSON Schema specification.

Declaration

1
public static bool SupportsVersion(this IJsonSchemaKeyword keyword, SpecVersion version)
ParameterTypeDescription
keywordIJsonSchemaKeywordThe keyword.
versionSpecVersionThe queried version.

Returns

true if the keyword is supported by the version; false otherwise

Unregister()

Unregisters a keyword type.

Declaration

1
public static void Unregister()

VersionsSupported(this IJsonSchemaKeyword keyword)

Gets the specification versions supported by a keyword.

Declaration

1
public static SpecVersion VersionsSupported(this IJsonSchemaKeyword keyword)
ParameterTypeDescription
keywordIJsonSchemaKeywordThe keyword.

Returns

The specification versions as a single flags value.

Contents