asyncapi-react
asyncapi-react copied to clipboard
feat: add plugin support for the react component
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
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".
Quality Gate passed
Issues
8 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code