asyncapi-react icon indicating copy to clipboard operation
asyncapi-react copied to clipboard

feat: add plugin support for the react component

Open AceTheCreator opened this issue 2 months ago • 2 comments

This PR introduces a plugin system for the AsyncAPI React component, enabling developers to extend and customize the documentation renderer with custom components, event handling, and dynamic plugin management.

Changes

  • New AsyncApiPlugin interface and PluginAPI for plugin development
  • Component registration in PluginSlot.OPERATION slots
  • Event system: on(), off(), emit() for inter-plugin communication
  • Dynamic plugin registration/unregistration at runtime
  • Priority-based component ordering (higher priority renders first)
  • Full TypeScript support
const plugin: AsyncApiPlugin = {
  name: 'my-plugin',
  version: '1.0.0',
  install(api: PluginAPI) {
    api.registerComponent(PluginSlot.OPERATION, MyComponent, { priority: 150 });
    api.on('event-name', (data) => console.log(data));
  }
};

<AsyncApi schema={schema} plugins={[plugin]} />

Fixes #914

Breaking Changes

None

AceTheCreator avatar Nov 12 '25 04:11 AceTheCreator

Just a heads up that your PR description has "Fixes" as a title, preventing the issue from being closed automatically when this PR is merged. It should follow the GitHub convention of "Fixes #914" or "Closes #914" or "Resolves #914".

fmvilas avatar Nov 12 '25 19:11 fmvilas