diff --git a/framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs b/framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs index 79153cd487..f7d85e3256 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Microsoft/AspNetCore/Builder/AbpSwaggerUIBuilderExtensions.cs @@ -9,7 +9,7 @@ public static class AbpSwaggerUIBuilderExtensions { public static IApplicationBuilder UseAbpSwaggerUI( this IApplicationBuilder app, - Action setupAction = null) + Action? setupAction = null) { var resolver = app.ApplicationServices.GetService(); @@ -17,7 +17,7 @@ public static class AbpSwaggerUIBuilderExtensions { options.InjectJavascript("ui/abp.js"); options.InjectJavascript("ui/abp.swagger.js"); - options.IndexStream = () => resolver.Resolver(); + options.IndexStream = () => resolver?.Resolver(); setupAction?.Invoke(options); }); diff --git a/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs index 0f5698ab08..13f1f2a296 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Microsoft/Extensions/DependencyInjection/AbpSwaggerGenServiceCollectionExtensions.cs @@ -12,7 +12,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions { public static IServiceCollection AddAbpSwaggerGen( this IServiceCollection services, - Action setupAction = null) + Action? setupAction = null) { return services.AddSwaggerGen( options => @@ -34,7 +34,7 @@ public static class AbpSwaggerGenServiceCollectionExtensions this IServiceCollection services, [NotNull] string authority, [NotNull] Dictionary scopes, - Action setupAction = null, + Action? setupAction = null, string authorizationEndpoint = "/connect/authorize", string tokenEndpoint = "/connect/token") { @@ -82,10 +82,10 @@ public static class AbpSwaggerGenServiceCollectionExtensions public static IServiceCollection AddAbpSwaggerGenWithOidc( this IServiceCollection services, [NotNull] string authority, - string[] scopes = null, - string[] flows = null, - string discoveryEndpoint = null, - Action setupAction = null) + string[]? scopes = null, + string[]? flows = null, + string? discoveryEndpoint = null, + Action? setupAction = null) { var discoveryUrl = discoveryEndpoint != null ? new Uri(discoveryEndpoint) : diff --git a/framework/src/Volo.Abp.Swashbuckle/Volo.Abp.Swashbuckle.csproj b/framework/src/Volo.Abp.Swashbuckle/Volo.Abp.Swashbuckle.csproj index bbfce19981..83c25f3e23 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Volo.Abp.Swashbuckle.csproj +++ b/framework/src/Volo.Abp.Swashbuckle/Volo.Abp.Swashbuckle.csproj @@ -5,6 +5,8 @@ net7.0 + enable + Nullable Volo.Abp.Swashbuckle Volo.Abp.Swashbuckle $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs index dd1b9705b8..d35443f98b 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/AbpSwashbuckleDocumentFilter.cs @@ -30,7 +30,7 @@ public class AbpSwashbuckleDocumentFilter : IDocumentFilter .RemoveAll(path => !actionUrls.Contains(path.Key)); } - protected virtual string RemoveRouteParameterConstraints(ActionDescriptor actionDescriptor) + protected virtual string? RemoveRouteParameterConstraints(ActionDescriptor actionDescriptor) { var route = actionDescriptor.AttributeRouteInfo?.Template?.EnsureStartsWith('/').Replace("?", ""); if (string.IsNullOrWhiteSpace(route)) diff --git a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/SwaggerHtmlResolver.cs b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/SwaggerHtmlResolver.cs index 1826fd9336..628a361826 100644 --- a/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/SwaggerHtmlResolver.cs +++ b/framework/src/Volo.Abp.Swashbuckle/Volo/Abp/Swashbuckle/SwaggerHtmlResolver.cs @@ -13,7 +13,7 @@ public class SwaggerHtmlResolver : ISwaggerHtmlResolver, ITransientDependency var stream = typeof(SwaggerUIOptions).GetTypeInfo().Assembly .GetManifestResourceStream("Swashbuckle.AspNetCore.SwaggerUI.index.html"); - var html = new StreamReader(stream) + var html = new StreamReader(stream!) .ReadToEnd() .Replace("SwaggerUIBundle(configObject)", "abp.SwaggerUIBundle(configObject)");