File tree Expand file tree Collapse file tree 1 file changed +25
-7
lines changed Expand file tree Collapse file tree 1 file changed +25
-7
lines changed Original file line number Diff line number Diff line change 2121builder . Services . AddSwaggerGen ( option =>
2222{
2323 option . SwaggerDoc ( "v1" , new OpenApiInfo { Title = "Admin Hub Api" , Version = "v1" } ) ;
24+
2425 option . AddSecurityDefinition ( "Bearer" , new OpenApiSecurityScheme
2526 {
2627 In = ParameterLocation . Header ,
3031 BearerFormat = "JWT" ,
3132 Scheme = "Bearer"
3233 } ) ;
34+
3335 option . AddSecurityRequirement ( new OpenApiSecurityRequirement
3436 {
3537 {
3638 new OpenApiSecurityScheme
3739 {
3840 Reference = new OpenApiReference
3941 {
40- Type = ReferenceType . SecurityScheme ,
41- Id = "Bearer"
42+ Type = ReferenceType . SecurityScheme ,
43+ Id = "Bearer"
4244 }
4345 } ,
44- new string [ ] { }
46+ new string [ ] { }
4547 }
4648 } ) ;
4749} ) ;
9698
9799app . UseSwagger ( ) ;
98100
99- // Configure the HTTP request pipeline.
100- if ( app . Environment . IsDevelopment ( ) )
101+ app . UseSwaggerUI ( options =>
101102{
102- app . UseSwaggerUI ( ) ;
103- }
103+ options . SwaggerEndpoint ( "/swagger/v1/swagger.json" , "Web API V1" ) ;
104+
105+ if ( app . Environment . IsDevelopment ( ) )
106+ {
107+ options . RoutePrefix = "swagger" ;
108+ }
109+ else
110+ {
111+ options . RoutePrefix = string . Empty ;
112+ }
113+ } ) ;
114+
115+ app . UseSwagger ( ) ;
116+
117+ // // Configure the HTTP request pipeline.
118+ // if (app.Environment.IsDevelopment())
119+ // {
120+ // app.UseSwaggerUI();
121+ // }
104122
105123app . UseHttpsRedirection ( ) ;
106124
You can’t perform that action at this time.
0 commit comments