Skip to content

Commit

Permalink
Migrate to NSwag
Browse files Browse the repository at this point in the history
Replace Swashbuckle with NSwag.
  • Loading branch information
martincostello committed Jan 14, 2024
1 parent f044ca8 commit 6a0ed1e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/TodoApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

// Configure OpenAPI documentation for the Todo API
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
builder.Services.AddOpenApiDocument(options =>
{
options.SwaggerDoc("v1", new() { Title = "Todo API", Version = "v1" });
options.Title = "Todo API";
options.Version = "v1";
});

if (string.Equals(builder.Configuration["CODESPACES"], "true", StringComparison.OrdinalIgnoreCase))
Expand Down Expand Up @@ -55,8 +56,8 @@
app.UseAuthentication();
app.UseAuthorization();

// Add Swagger endpoint for OpenAPI
app.UseSwagger();
// Add endpoint for OpenAPI
app.UseOpenApi();

// Add the HTTP endpoints
app.MapAuthenticationRoutes();
Expand Down
2 changes: 1 addition & 1 deletion src/TodoApp/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"TodoApp": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"applicationUrl": "https://localhost:50001;http://localhost:50000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
2 changes: 1 addition & 1 deletion src/TodoApp/TodoApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="AspNet.Security.OAuth.GitHub" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.1" />
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.3.3" PrivateAssets="all" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="NSwag.AspNetCore" Version="14.0.1" />
</ItemGroup>
<ItemGroup>
<Content Update="package.json;package-lock.json;tsconfig.json" CopyToPublishDirectory="Never" />
Expand Down

0 comments on commit 6a0ed1e

Please sign in to comment.