You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have successfully configured the apiverion。but when deployed , I found that Audit log no longer logs
Reproduction Steps
modify host module :
add
/// <summary>/// Configures the Swagger generation options./// </summary>/// <remarks>This allows API versioning to define a Swagger document per API version after the/// <see cref="IApiVersionDescriptionProvider"/> service has been resolved from the service container.</remarks>publicclassConfigureSwaggerOptions:IConfigureOptions<SwaggerGenOptions>{readonlyIApiVersionDescriptionProviderprovider;/// <summary>/// Initializes a new instance of the <see cref="ConfigureSwaggerOptions"/> class./// </summary>/// <param name="provider">The <see cref="IApiVersionDescriptionProvider">provider</see> used to generate Swagger documents.</param>publicConfigureSwaggerOptions(IApiVersionDescriptionProviderprovider)=>this.provider =provider;/// <inheritdoc />publicvoidConfigure(SwaggerGenOptionsoptions){// add a swagger document for each discovered API version// note: you might choose to skip or document deprecated API versions differentlyforeach(var description in provider.ApiVersionDescriptions ){
options.SwaggerDoc( description.GroupName, CreateInfoForApiVersion( description ));}}static OpenApiInfo CreateInfoForApiVersion(ApiVersionDescriptiondescription){varinfo=new OpenApiInfo(){Title="BookStore API",Version= description.ApiVersion.ToString(),};if( description.IsDeprecated ){
info.Description +=" This API version has been deprecated.";}returninfo;}}/// <summary>/// Represents the Swagger/Swashbuckle operation filter used to document the implicit API version parameter./// </summary>/// <remarks>This <see cref="IOperationFilter"/> is only required due to bugs in the <see cref="SwaggerGenerator"/>./// Once they are fixed and published, this class can be removed.</remarks>publicclassSwaggerDefaultValues:IOperationFilter{/// <summary>/// Applies the filter to the specified operation using the given context./// </summary>/// <param name="operation">The operation to apply the filter to.</param>/// <param name="context">The current operation filter context.</param>publicvoidApply(OpenApiOperationoperation,OperationFilterContextcontext){varapiDescription= context.ApiDescription;
operation.Deprecated |= apiDescription.IsDeprecated();// REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1752#issue-663991077foreach(var responseType in context.ApiDescription.SupportedResponseTypes){// REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/b7cf75e7905050305b115dd96640ddd6e74c7ac9/src/Swashbuckle.AspNetCore.SwaggerGen/SwaggerGenerator/SwaggerGenerator.cs#L383-L387varresponseKey= responseType.IsDefaultResponse ?"default": responseType.StatusCode.ToString();varresponse= operation.Responses[responseKey];foreach(var contentType in response.Content.Keys){if(!responseType.ApiResponseFormats.Any(x => x.MediaType ==contentType)){
response.Content.Remove(contentType);}}}if(operation.Parameters ==null){return;}// REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/412// REF: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/pull/413foreach(var parameter in operation.Parameters){vardescription= apiDescription.ParameterDescriptions.First(p => p.Name == parameter.Name);if(parameter.Description ==null){
parameter.Description = description.ModelMetadata?.Description;}if(parameter.Schema.Default ==null&& description.DefaultValue !=null){// REF: https://github.com/Microsoft/aspnet-api-versioning/issues/429#issuecomment-605402330varjson= JsonSerializer.Serialize(description.DefaultValue, description.ModelMetadata.ModelType);
parameter.Schema.Default = OpenApiAnyFactory.CreateFromJson(json);}
parameter.Required |= description.IsRequired;}}}
modify ConfigureServices
varpreActions= context.Services.GetPreConfigureActions<AbpAspNetCoreMvcOptions>();Configure<AbpAspNetCoreMvcOptions>(options =>{ preActions.Configure(options);});
context.Services.AddAbpApiVersioning(options =>{// Show neutral/versionless APIs. options.UseApiBehavior =false; options.ReportApiVersions =true; options.AssumeDefaultVersionWhenUnspecified =true; options.ConfigureAbp(preActions.Configure());});
context.Services.AddVersionedApiExplorer(options =>{// add the versioned api explorer, which also adds IApiVersionDescriptionProvider service// note: the specified format code will format the version as "'v'major[.minor][-status]" options.GroupNameFormat ="'v'VVV";// note: this option is only necessary when versioning by url segment. the SubstitutionFormat// can also be used to control the format of the API version in route templates options.SubstituteApiVersionInUrl =true;});
context.Services.AddTransient<IConfigureOptions<SwaggerGenOptions>,ConfigureSwaggerOptions>();
context.Services.AddAbpSwaggerGenWithOAuth(
configuration["AuthServer:Authority"]!,newDictionary<string,string>{{"MemberOpenApi","MemberOpenApi API"}},options =>{//options.SwaggerDoc("v1", new OpenApiInfo {Title = "MemberOpenApi API", Version = "v1"}); options.OperationFilter<SwaggerDefaultValues>();//options.DocInclusionPredicate((docName, description) => true); options.CustomSchemaIds(type => type.FullName);});Configure<AbpAspNetCoreMvcOptions>(options =>{ options.ChangeControllerModelApiExplorerGroupName =false;});
and OnApplicationInitialization
app.UseAbpSwaggerUI(options =>{//options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API");varprovider= app.ApplicationServices.GetRequiredService<IApiVersionDescriptionProvider>();// build a swagger endpoint for each discovered API versionforeach(var description in provider.ApiVersionDescriptions){ options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json", description.GroupName.ToUpperInvariant());}varconfiguration= context.GetConfiguration(); options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); options.OAuthScopes("MemberOpenApi");});
Expected behavior
log Audit log as before
Actual behavior
no audit log anymore
Regression?
No response
Known Workarounds
No response
Version
7.3.3
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
Separate Auth Server
Operation System
Windows (Default)
Other information
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Description
after learn form
https://github.com/abpframework/abp-samples/tree/master/Api-Versioning
and
https://docs.abp.io/en/abp/latest/API/API-Versioning
I have successfully configured the apiverion。but when deployed , I found that Audit log no longer logs
Reproduction Steps
modify host module :
add
modify ConfigureServices
and OnApplicationInitialization
Expected behavior
log Audit log as before
Actual behavior
no audit log anymore
Regression?
No response
Known Workarounds
No response
Version
7.3.3
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
Separate Auth Server
Operation System
Windows (Default)
Other information
No response
The text was updated successfully, but these errors were encountered: