以下是启动的代码
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseStaticFiles();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(su =>
{
su.SwaggerEndpoint("/swagger/general/swagger.json", "Common API");
su.RoutePrefix = string.Empty;
});
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers()
.AddJsonOptions(options =>
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));
services.AddSwaggerGen(c
=>
{
c.SwaggerDoc("general", new Microsoft.OpenApi.Models.OpenApiInfo
{
Title = "Common API",
Version = "General Purpose",
Description = "TEST API",
Contact = new Microsoft.OpenApi.Models.OpenApiContact
{
Name = "VJ-TESTER",
Email = "[email protected]",
},
});
// Set the comments path for the Swagger JSON and UI.
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
c.IncludeXmlComments(xmlPath);
});
}
它可能来自于控制器端点inout参数。