Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

Swagger UI not working with Post ICommand #44

Open
solvingproblemswithtechnology opened this issue May 21, 2020 · 1 comment
Open

Swagger UI not working with Post ICommand #44

solvingproblemswithtechnology opened this issue May 21, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@solvingproblemswithtechnology

When I register an ICommand using UseDispatcherEndpoints I expect that swagger asks me for a JSON with the command. Instead of it, the UI shows me the request like a string field and after I wrote something the field gets cleared.

image

My Code:

return WebHost.CreateDefaultBuilder(args)
    .ConfigureServices(services =>
    {
        services.AddConvey()
            .AddWebApi()
            .AddWebApiSwaggerDocs(options => options
                .Enable(true)
                .WithName("Order Sample API")
                .WithTitle("Order Sample API")
                .WithVersion("1"))
            .AddCommandHandlers()
            .AddQueryHandlers()
            .AddInMemoryCommandDispatcher()
            .AddInMemoryQueryDispatcher()
            .Build();
    })
    .Configure(app =>
    {
        app.UseSwaggerDocs()
            .UsePublicContracts<Contract>()
            .UseDispatcherEndpoints(endpoints => endpoints
                .Post<PlaceOrderRequest>("api/Orders")
            );
    })
    .ConfigureLogging((ctx, builder) =>
    {
        builder.ClearProviders();

        if (ctx.HostingEnvironment.IsDevelopment()) builder.AddConsole();
    })
    .UseSerilog((ctx, builder) => builder.Enrich.FromLogContext()
            .ReadFrom.Configuration(ctx.Configuration)
            .WriteTo.Async(async => async.Debug())
            .WriteTo.Seq("http://localhost:5341"), writeToProviders: true)
    .Build().RunAsync();
@GooRiOn
Copy link
Member

GooRiOn commented Nov 8, 2020

Related to issue #25

@GooRiOn GooRiOn added the bug Something isn't working label Nov 8, 2020
This was referenced Feb 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants