Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants