Skip to content

Commit d91968b

Browse files
authored
Move MapOpenApi() Inside the IsDevelopment() block for consistency with templates and other docs
The default template with .NET 9 has MapOpenApi() inside the IsDevelopment block. Many examples on MS Learn also have it inside due to limit information exposure. Move inside to minimize potential for confusion to devs.
1 parent d0e4675 commit d91968b

File tree

1 file changed

+2
-1
lines changed
  • aspnetcore/fundamentals/openapi/samples/9.x/WebMinOpenApi

1 file changed

+2
-1
lines changed

aspnetcore/fundamentals/openapi/samples/9.x/WebMinOpenApi/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,10 @@ public class Body {
279279

280280
var app = builder.Build();
281281

282-
app.MapOpenApi();
283282
if (app.Environment.IsDevelopment())
284283
{
284+
app.MapOpenApi();
285+
285286
app.UseSwaggerUI(options =>
286287
{
287288
options.SwaggerEndpoint("/openapi/v1.json", "v1");

0 commit comments

Comments
 (0)