Home FormatRegistry Class
FormatRegistry Class
Cancel

FormatRegistry Class

Namespace: Json.Schema

Inheritance: FormatRegistry 🡒 object

Represents a thread-safe registry for managing and retrieving format definitions within the application.

Remarks

Use the FormatRegistry to register, unregister, and look up format definitions by key. The static Global property provides access to a shared, application-wide registry pre-populated with common formats. This class is designed for scenarios where centralized management of formats is required, and is safe for use across multiple

Properties

NameTypeSummary
Draft06FormatRegistryGets the formats defined by the Draft 6 dialect.
Draft07FormatRegistryGets the formats defined by the Draft 7 dialect.
Draft201909FormatRegistryGets the formats defined by the Draft 2019-09 dialect.
Draft202012FormatRegistryGets the formats defined by the Draft 2020-12 dialect.
GlobalFormatRegistryGets the global registry of formats available throughout the application.
V1FormatRegistryGets the formats defined by the V1 dialect.

Constructors

FormatRegistry(IEnumerable<Format> formats)

Creates a new format registry.

Declaration

1
public FormatRegistry(IEnumerable<Format> formats)
ParameterTypeDescription
formatsIEnumerable<Format>The list of formats for the registry to provide.

Methods

Get(string key)

Retrieves the format associated with the specified key, searching local and global collections.

Declaration

1
public Format Get(string key)
ParameterTypeDescription
keystringThe key that identifies the format to retrieve. Cannot be null.

Returns

The format associated with the specified key if found; otherwise, a format representing an unknown key.

Remarks

If the format is not found in the local collection, the method searches the global collection

Register(Format format)

Registers the specified format for later retrieval by its key.

Declaration

1
public void Register(Format format)
ParameterTypeDescription
formatFormatThe format to register. The format’s key must be unique within the collection.

Unregister(string name)

Unregisters the format associated with the specified name, removing it from the collection if it exists.

Declaration

1
public void Unregister(string name)
ParameterTypeDescription
namestringThe name of the format to unregister. Cannot be null.

Remarks

If no format is registered with the specified name, this method has no effect. This method is

Contents