Skip to main content

getMessageBySchemaPath

Callable

  • getMessageBySchemaPath(directory: string): (path: string, options?: { attachSchema?: boolean }) => Promise<Message>

  • Returns a message from EventCatalog by a given schema path.

    @example
    import utils from '@eventcatalog/utils';

    const { getMessageBySchemaPath } = utils('/path/to/eventcatalog');

    // Get the message by the schema path
    const message = await getMessageBySchemaPath('/path/to/eventcatalog/messages/InventoryAdjusted/schema.json');
    const message = await getMessageBySchemaPath('/path/to/eventcatalog/messages/InventoryAdjusted/schema.avro');