Kros-sk / Kros.BusEventDoc

Tool for generating documentation of domain events.
MIT License
0 stars 1 forks source link

Kros.BusEventDoc

Tool for generating documentation of domain events. Inludes a simple UI to depict what specified events, commands are used in specific service. This library is inspired by Swagger. Project is still evolving.

Get Started

  1. Instal Nuget package into your ASP.NET Core application.
dotnet add package Kros.BusEventDoc
  1. In the ConfigureServices method of Startup.cs, register the BusEventDoc generator, defining BusEventDoc document.
using Kros.EventBusDoc.Generator.Middleware.Extensions;

services.AddEventBusDocGen(c =>
    c.EventBusDoc("v1", new Info { Version = "v1", Title = "Demo" })
);
  1. In the Configure method, attach to the pipeline BusEventDoc generator. Generator produces json.
app.UseEventBusDoc();
  1. For generation and exploring definitions and types use BusEventDoc attribute annotation to specify the subjects. We recommend use this annotation in the AssemblyInfo.cs.
using Kros.EventBusDoc.Generator.BusentAnnotation;

[assembly: BusEvent(EventType =typeof(ISendEvent) )]
[assembly: EventBusCommandConsumer(EventType =typeof(IConsumeOne) )]
[assembly: EventBusCommandSender(EventType =typeof(ISendCommand) )]
  1. To visual json document generated by BusEventDoc generator insert BusEventDoc UI middleware, with specific endpoint(s).
dotnet add package Kros.BusEventDoc.UI
app.UseEventBusDocUI(c => { c.EventBusDocEndPoint("v1/busent.json", "Demo"); });
  1. If the BusEventDoc is configured we can call for output "/busent".

You can see simple example DEMO