When I power my APIs with Swagger, I follow one of those guids and I always put the MVC injections before Swagger injections like this.
services.AddMvc();
services.AddSwaggerGen(_ => { ... });
app.UseMvc();
app.UseSwagger();
app.UseSwaggerUI(c => { ... });
A friend of mine asked why I apply that order and not handle the Swagger related lines first, before MVC. I discovered that I couldn't explain that to him nor motivate it (other than a very embarrassed well... that's the way it is...). That tells me that I should dig a bit into that matter.
Short googling revealed nothing of relevance as far I've noticed, so I'm asking here.