essencebit / SignalRSwaggerGen

MIT License
70 stars 8 forks source link

Generate documentation for hub in a sub-assembly #17

Closed jaytonic closed 2 years ago

jaytonic commented 2 years ago

Hi,

I've my Asp.Net core splited in several projects. I do reference them in my main Program.cs like this:

[...]
builder.Services.AddControllers()
    .PartManager.ApplicationParts.Add(new AssemblyPart(typeof(SomeClassOfMyOtherAssembly).Assembly));

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
{
    options.SwaggerDoc("v1", new OpenApiInfo(){Title = "Wonderfull API"});
    options.AddSignalRSwaggerGen();
});
[...]

All my controllers are currently in those other assemblies, and when I display swagger, those other controller are properly displayed.

In this other project, I've a Strongly typed Hub:

   [SignalRHub]

    public class ProjectHub:Hub<IProjectHubClient>
    {
    }
    public interface IProjectHubClient
    {
        Task DashboardDeleted(Guid dashboardId);

        Task DashboardInserted(DashboardDto dashboardDto);

        Task DashboardUpdated(DashboardDto dashboardDto);
    }

But when I build and launch the project, there is nothing on the swagger web page that display my web socket. Am I missing something or is this just not supported?

Dorin-Mocan commented 2 years ago

@jaytonic , you can pass to AddSignalRSwaggerGen() method the assemblies that need to be scanned. Please try, and if you can't figure out how, let me know, I'll help.