File tree 1 file changed +14
-12
lines changed
examples/AspNetCore/WebApi/MinimalOpenApiExample
1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 264
264
. Produces ( 400 ) ;
265
265
266
266
app . UseSwagger ( ) ;
267
- app . UseSwaggerUI (
268
- options =>
269
- {
270
- var descriptions = app . DescribeApiVersions ( ) ;
271
-
272
- // build a swagger endpoint for each discovered API version
273
- foreach ( var description in descriptions )
267
+ if ( builder . Environment . IsDevelopment ( ) )
268
+ {
269
+ app . UseSwaggerUI (
270
+ options =>
274
271
{
275
- var url = $ "/swagger/{ description . GroupName } /swagger.json";
276
- var name = description . GroupName . ToUpperInvariant ( ) ;
277
- options . SwaggerEndpoint ( url , name ) ;
278
- }
279
- } ) ;
272
+ var descriptions = app . DescribeApiVersions ( ) ;
280
273
274
+ // build a swagger endpoint for each discovered API version
275
+ foreach ( var description in descriptions )
276
+ {
277
+ var url = $ "/swagger/{ description . GroupName } /swagger.json";
278
+ var name = description . GroupName . ToUpperInvariant ( ) ;
279
+ options . SwaggerEndpoint ( url , name ) ;
280
+ }
281
+ } ) ;
282
+ }
281
283
app . Run ( ) ;
You can’t perform that action at this time.
0 commit comments