ISchemaLocater Interface

The interface defines what is needed to be an ISchemaLocater. A Schema Locater loads the requested schema if it can or returns undefined. Schema Locaters should always load the schema on each request and should not hold a cache of schemas. Schema locaters should never be used directly to load a schema, they should be added to a SchemaContext and the context should be used to load schemas. The SchemaContext caches schemas and manages schema life time.

Implemented by

Methods

Name Description
getSchema<T extends Schema<T>>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<undefined | T> Attempts to get a schema from the locater.  
getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): Promise<undefined | SchemaInfo> Gets the schema info which matches the provided SchemaKey.  
getSchemaSync<T extends Schema<T>>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType, context: SchemaContext): undefined | T Attempts to get a schema from the locater.  

Defined in

Last Updated: 28 March, 2024