SchemaContext Class

The SchemaContext, context object is used to facilitate schema and schema item location.

The context controls the lifetime of each schema that it knows about. It has to be explicitly removed from the context to delete a schema object.

The context is made up of a group of Schema Locators.

Implements

Methods

Name Description
constructor(): SchemaContext    
addLocater(locater: ISchemaLocater): void    
addSchema(schema: Schema): Promise<void> Adds the schema to this context.  
addSchemaItem(schemaItem: SchemaItem): Promise<void> Adds the given SchemaItem to the the SchemaContext by locating the schema, with the best match of SchemaMatchType.Exact, and Deprecated  
addSchemaPromise(schemaInfo: SchemaInfo, schema: Schema, schemaPromise: Promise<Schema>): Promise<void> Adds a promise to load the schema to the cache.  
addSchemaSync(schema: Schema): void Adds the schema to this context  
getKnownSchemas(): Schema[] Gets all the Schemas known by the context.  
getSchema<T extends Schema<T>>(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType = SchemaMatchType.Latest): Promise<undefined | T> Attempts to obtain a schema from this context that matches the specified criteria.  
getSchemaInfo(schemaKey: Readonly<SchemaKey>, matchType: SchemaMatchType): Promise<undefined | SchemaInfo> Gets the schema info which matches the provided SchemaKey.  
getSchemaItem<T extends SchemaItem<T>>(schemaItemKey: SchemaItemKey): Promise<undefined | T> Gets the schema item from the specified schema if it exists in this SchemaContext.  
getSchemaItemSync<T extends SchemaItem<T>>(schemaItemKey: SchemaItemKey): undefined | T Gets the schema item from the specified schema if it exists in this SchemaContext.  
getSchemaItems(): IterableIterator<SchemaItem> Iterates through the items of each schema known to the context.  
getSchemaSync<T extends Schema<T>>(schemaKey: SchemaKey, matchType: SchemaMatchType = SchemaMatchType.Latest): undefined | T Attempts to obtain a schema from this context that matches the specified criteria.  
schemaExists(schemaKey: Readonly<SchemaKey>): boolean Returns true if the schema is already in the context.  

Defined in

Last Updated: 16 April, 2024