File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
examples/AspNetCore/WebApi/MinimalOpenApiExample Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change 264264 . Produces ( 400 ) ;
265265
266266app . 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 =>
274271 {
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 ( ) ;
280273
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+ }
281283app . Run ( ) ;
You can’t perform that action at this time.
0 commit comments