-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update to current version * cleanup AddSwaggerGen snippets * moving OpenApiInfo to proper location * powerapps and flow version note 2.0 example * annotations update * annotations edit * edit pass * fix note * update line number Co-authored-by: Scott Addie <[email protected]>
- Loading branch information
1 parent
d26d4aa
commit d87c506
Showing
5 changed files
with
81 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...re/tutorials/web-api-help-pages-using-swagger/samples/3.0/TodoApi.Swashbuckle/Startup3.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.OpenApi.Models; | ||
using TodoApi.Models; | ||
|
||
namespace TodoApi | ||
{ | ||
public class Startup2 | ||
{ | ||
#region snippet_ConfigureServices | ||
public void ConfigureServices(IServiceCollection services) | ||
{ | ||
services.AddDbContext<TodoContext>(opt => | ||
opt.UseInMemoryDatabase("TodoList")); | ||
services.AddControllers(); | ||
|
||
// Register the Swagger generator, defining 1 or more Swagger documents | ||
services.AddSwaggerGen(); | ||
} | ||
#endregion | ||
|
||
#region snippet_Configure | ||
public void Configure(IApplicationBuilder app) | ||
{ | ||
// Enable middleware to serve generated Swagger as a JSON endpoint. | ||
app.UseSwagger(c => | ||
{ | ||
c.SerializeAsV2 = true; | ||
}); | ||
|
||
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), | ||
// specifying the Swagger JSON endpoint. | ||
app.UseSwaggerUI(c => | ||
{ | ||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1"); | ||
}); | ||
|
||
app.UseRouting(); | ||
app.UseEndpoints(endpoints => | ||
{ | ||
endpoints.MapControllers(); | ||
}); | ||
} | ||
#endregion | ||
} | ||
} |