Function: getSchemaForMessage()
getSchemaForMessage(
directory): (id,version?) =>Promise<{fileName:string;schema:string; }>
Defined in: messages.ts:194
Returns the schema for a given message (event, command or query) by its id and version.
If no version is given, the latest version is used.
Parameters​
| Parameter | Type |
|---|---|
directory | string |
Returns​
Function
Parameters​
| Parameter | Type |
|---|---|
id | string |
version? | string |
Returns​
Promise<{ fileName: string; schema: string; }>
Example​
import utils from '@eventcatalog/utils';
const { getSchemaForMessage } = utils('/path/to/eventcatalog');
// Get the schema for the latest version of the message
const schema = await getSchemaForMessage('InventoryAdjusted');
// Get the schema for a specific version
const schema = await getSchemaForMessage('InventoryAdjusted', '0.0.1');