From 95ae085c20310c64790a9b9e744cd8324102cc6e Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 5 Sep 2023 16:05:37 +0800 Subject: [PATCH] Enable nullable annotations for Volo.Abp.Http --- .../AspNetCoreApiDescriptionModelProvider.cs | 2 +- .../ServiceProxyGenerationModel.cs | 2 +- .../src/Volo.Abp.Http/Volo.Abp.Http.csproj | 2 ++ .../Volo/Abp/Http/HttpMethodHelper.cs | 6 +++--- .../Modeling/ActionApiDescriptionModel.cs | 20 +++++++++---------- .../Abp/Http/Modeling/ApiTypeNameHelper.cs | 16 +++++++-------- .../ApplicationApiDescriptionModel.cs | 6 +++--- .../Modeling/ControllerApiDescriptionModel.cs | 20 +++++++++---------- .../ControllerInterfaceApiDescriptionModel.cs | 8 ++++---- .../InterfaceMethodApiDescriptionModel.cs | 6 +++--- .../MethodParameterApiDescriptionModel.cs | 12 +++++------ .../Modeling/ModuleApiDescriptionModel.cs | 12 +++++------ .../Modeling/ParameterApiDescriptionModel.cs | 20 +++++++++---------- .../Modeling/PropertyApiDescriptionModel.cs | 14 ++++++------- .../ReturnValueApiDescriptionModel.cs | 4 ++-- .../Http/Modeling/TypeApiDescriptionModel.cs | 10 +++++----- .../AbpApiProxyScriptingConfiguration.cs | 2 +- .../JQuery/JQueryProxyScriptGenerator.cs | 6 +++--- .../Generators/ProxyScriptingHelper.cs | 6 +++--- .../ProxyScripting/ProxyScriptingModel.cs | 6 +++--- 20 files changed, 91 insertions(+), 89 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs index 9e3b0bfba2..f1d014b76a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs @@ -145,7 +145,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide ActionApiDescriptionModel.Create( uniqueMethodName, method, - apiDescription.RelativePath, + apiDescription.RelativePath!, apiDescription.HttpMethod, GetSupportedVersions(controllerType, method, setting), allowAnonymous, diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs index b912d3905a..d4fd27d889 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs @@ -32,7 +32,7 @@ public class ServiceProxyGenerationModel public ProxyScriptingModel CreateOptions() { - var options = new ProxyScriptingModel(Type, UseCache); + var options = new ProxyScriptingModel(Type!, UseCache); if (!Modules.IsNullOrEmpty()) { diff --git a/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj b/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj index 3b029e3b9d..11cdaffe09 100644 --- a/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj +++ b/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj @@ -5,6 +5,8 @@ netstandard2.0;netstandard2.1;net7.0 + enable + Nullable Volo.Abp.Http Volo.Abp.Http $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs index 603b6797c3..78ee75e901 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs @@ -43,12 +43,12 @@ public static class HttpMethodHelper return methodName; } - return methodName.RemovePreFix(prefixes); + return methodName.RemovePreFix(prefixes!); } - public static HttpMethod ConvertToHttpMethod(string httpMethod) + public static HttpMethod ConvertToHttpMethod(string? httpMethod) { - switch (httpMethod.ToUpperInvariant()) + switch (httpMethod?.ToUpperInvariant()) { case "GET": return HttpMethod.Get; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs index 9e1d208ddf..890637d801 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs @@ -10,32 +10,32 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ActionApiDescriptionModel { - public string UniqueName { get; set; } + public string UniqueName { get; set; } = default!; - public string Name { get; set; } + public string Name { get; set; } = default!; - public string HttpMethod { get; set; } + public string? HttpMethod { get; set; } - public string Url { get; set; } + public string Url { get; set; } = default!; - public IList SupportedVersions { get; set; } + public IList? SupportedVersions { get; set; } - public IList ParametersOnMethod { get; set; } + public IList ParametersOnMethod { get; set; } = default!; - public IList Parameters { get; set; } + public IList Parameters { get; set; } = default!; - public ReturnValueApiDescriptionModel ReturnValue { get; set; } + public ReturnValueApiDescriptionModel ReturnValue { get; set; } = default!; public bool? AllowAnonymous { get; set; } - public string ImplementFrom { get; set; } + public string? ImplementFrom { get; set; } public ActionApiDescriptionModel() { } - public static ActionApiDescriptionModel Create([NotNull] string uniqueName, [NotNull] MethodInfo method, [NotNull] string url, [CanBeNull] string httpMethod, [NotNull] IList supportedVersions, bool? allowAnonymous = null, string implementFrom = null) + public static ActionApiDescriptionModel Create([NotNull] string uniqueName, [NotNull] MethodInfo method, [NotNull] string url, string? httpMethod, [NotNull] IList supportedVersions, bool? allowAnonymous = null, string? implementFrom = null) { Check.NotNull(uniqueName, nameof(uniqueName)); Check.NotNull(method, nameof(method)); diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs index 6907287f88..a9062655d0 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs @@ -17,16 +17,16 @@ public static class ApiTypeNameHelper if (TypeHelper.IsDictionary(type, out var keyType, out var valueType)) { - if (!duplicateTypes.Contains(keyType) && !duplicateTypes.Contains(valueType)) + if (!duplicateTypes.Contains(keyType!) && !duplicateTypes.Contains(valueType!)) { - return $"{{{GetTypeName(keyType, duplicateTypes)}:{GetTypeName(valueType, duplicateTypes)}}}"; + return $"{{{GetTypeName(keyType!, duplicateTypes)}:{GetTypeName(valueType!, duplicateTypes)}}}"; } } else if (TypeHelper.IsEnumerable(type, out var itemType, includePrimitives: false)) { - if (!duplicateTypes.Contains(itemType)) + if (!duplicateTypes.Contains(itemType!)) { - return $"[{GetTypeName(itemType, duplicateTypes)}]"; + return $"[{GetTypeName(itemType!, duplicateTypes)}]"; } } @@ -44,16 +44,16 @@ public static class ApiTypeNameHelper if (TypeHelper.IsDictionary(type, out var keyType, out var valueType)) { - if (!duplicateTypes.Contains(keyType) && !duplicateTypes.Contains(valueType)) + if (!duplicateTypes.Contains(keyType!) && !duplicateTypes.Contains(valueType!)) { - return $"{{{GetSimpleTypeName(keyType, duplicateTypes)}:{GetSimpleTypeName(valueType, duplicateTypes)}}}"; + return $"{{{GetSimpleTypeName(keyType!, duplicateTypes)}:{GetSimpleTypeName(valueType!, duplicateTypes)}}}"; } } else if (TypeHelper.IsEnumerable(type, out var itemType, includePrimitives: false)) { - if (!duplicateTypes.Contains(itemType)) + if (!duplicateTypes.Contains(itemType!)) { - return $"[{GetSimpleTypeName(itemType, duplicateTypes)}]"; + return $"[{GetSimpleTypeName(itemType!, duplicateTypes)}]"; } } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs index edebd656cb..03b3751125 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs @@ -8,9 +8,9 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ApplicationApiDescriptionModel { - public IDictionary Modules { get; set; } + public IDictionary Modules { get; set; } = default!; - public IDictionary Types { get; set; } + public IDictionary Types { get; set; } = default!; public ApplicationApiDescriptionModel() { @@ -41,7 +41,7 @@ public class ApplicationApiDescriptionModel return Modules.GetOrAdd(rootPath, () => ModuleApiDescriptionModel.Create(rootPath, remoteServiceName)); } - public ApplicationApiDescriptionModel CreateSubModel(string[] modules = null, string[] controllers = null, string[] actions = null) + public ApplicationApiDescriptionModel CreateSubModel(string[]? modules = null, string[]? controllers = null, string[]? actions = null) { var subModel = ApplicationApiDescriptionModel.Create(); ; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs index e2e0e53e9f..97919e54ba 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs @@ -8,28 +8,28 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ControllerApiDescriptionModel { - public string ControllerName { get; set; } + public string ControllerName { get; set; } = default!; - public string ControllerGroupName { get; set; } + public string? ControllerGroupName { get; set; } public bool IsRemoteService { get; set; } public bool IsIntegrationService { get; set; } - public string ApiVersion { get; set; } + public string? ApiVersion { get; set; } - public string Type { get; set; } + public string Type { get; set; } = default!; - public List Interfaces { get; set; } + public List Interfaces { get; set; } = default!; - public Dictionary Actions { get; set; } + public Dictionary Actions { get; set; } = default!; public ControllerApiDescriptionModel() { } - public static ControllerApiDescriptionModel Create(string controllerName, string groupName, bool isRemoteService, bool isIntegrationService, string apiVersion, Type type, [CanBeNull] HashSet ignoredInterfaces = null) + public static ControllerApiDescriptionModel Create(string controllerName, string? groupName, bool isRemoteService, bool isIntegrationService, string? apiVersion, Type type, HashSet? ignoredInterfaces = null) { return new ControllerApiDescriptionModel { @@ -38,11 +38,11 @@ public class ControllerApiDescriptionModel IsRemoteService = isRemoteService, IsIntegrationService = isIntegrationService, //IntegrationServiceAttribute.IsDefinedOrInherited(type), ApiVersion = apiVersion, - Type = type.FullName, + Type = type.FullName!, Actions = new Dictionary(), Interfaces = type .GetInterfaces() - .WhereIf(ignoredInterfaces != null, i => !i.IsGenericType && !ignoredInterfaces.Contains(i)) + .WhereIf(ignoredInterfaces != null, i => !i.IsGenericType && !ignoredInterfaces!.Contains(i)) .Select(ControllerInterfaceApiDescriptionModel.Create) .ToList() }; @@ -60,7 +60,7 @@ public class ControllerApiDescriptionModel return Actions[uniqueName] = action; } - public ControllerApiDescriptionModel CreateSubModel(string[] actions) + public ControllerApiDescriptionModel CreateSubModel(string[]? actions) { var subModel = new ControllerApiDescriptionModel { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs index a0cfe31e26..a95e2ac547 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs @@ -8,11 +8,11 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ControllerInterfaceApiDescriptionModel { - public string Type { get; set; } + public string Type { get; set; } = default!; - public string Name { get; set; } + public string Name { get; set; } = default!; - public InterfaceMethodApiDescriptionModel[] Methods { get; set; } + public InterfaceMethodApiDescriptionModel[] Methods { get; set; } = default!; public ControllerInterfaceApiDescriptionModel() { @@ -23,7 +23,7 @@ public class ControllerInterfaceApiDescriptionModel { var model = new ControllerInterfaceApiDescriptionModel { - Type = type.FullName, + Type = type.FullName!, Name = type.Name }; diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs index 53a4349854..32b79ce3e1 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs @@ -9,11 +9,11 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class InterfaceMethodApiDescriptionModel { - public string Name { get; set; } + public string Name { get; set; } = default!; - public IList ParametersOnMethod { get; set; } + public IList ParametersOnMethod { get; set; } = default!; - public ReturnValueApiDescriptionModel ReturnValue { get; set; } + public ReturnValueApiDescriptionModel ReturnValue { get; set; } = default!; public InterfaceMethodApiDescriptionModel() { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs index ed1de76c0e..c3ff20b897 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs @@ -7,17 +7,17 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class MethodParameterApiDescriptionModel { - public string Name { get; set; } + public string Name { get; set; } = default!; - public string TypeAsString { get; set; } + public string TypeAsString { get; set; } = default!; - public string Type { get; set; } + public string Type { get; set; } = default!; - public string TypeSimple { get; set; } + public string TypeSimple { get; set; } = default!; public bool IsOptional { get; set; } - public object DefaultValue { get; set; } + public object? DefaultValue { get; set; } public MethodParameterApiDescriptionModel() { @@ -28,7 +28,7 @@ public class MethodParameterApiDescriptionModel { return new MethodParameterApiDescriptionModel { - Name = parameterInfo.Name, + Name = parameterInfo.Name!, TypeAsString = parameterInfo.ParameterType.GetFullNameWithAssemblyName(), Type = TypeHelper.GetFullNameHandlingNullableAndGenerics(parameterInfo.ParameterType), TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(parameterInfo.ParameterType), diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs index bb2c25e3eb..3a7607376c 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs @@ -18,11 +18,11 @@ public class ModuleApiDescriptionModel /// public const string DefaultRemoteServiceName = "Default"; - public string RootPath { get; set; } + public string RootPath { get; set; } = default!; - public string RemoteServiceName { get; set; } + public string RemoteServiceName { get; set; } = default!; - public IDictionary Controllers { get; set; } + public IDictionary Controllers { get; set; } = default!; public ModuleApiDescriptionModel() { @@ -49,13 +49,13 @@ public class ModuleApiDescriptionModel return Controllers[controller.Type] = controller; } - public ControllerApiDescriptionModel GetOrAddController(string name, string groupName, bool isRemoteService, bool isIntegrationService, string apiVersion, Type type, [CanBeNull] HashSet ignoredInterfaces = null) + public ControllerApiDescriptionModel GetOrAddController(string name, string? groupName, bool isRemoteService, bool isIntegrationService, string? apiVersion, Type type, HashSet? ignoredInterfaces = null) { - var key = apiVersion.IsNullOrWhiteSpace() ? type.FullName : $"{apiVersion + "."}{type.FullName}"; + var key = (apiVersion.IsNullOrWhiteSpace() ? type.FullName : $"{apiVersion + "."}{type.FullName}")!; return Controllers.GetOrAdd(key, () => ControllerApiDescriptionModel.Create(name, groupName, isRemoteService, isIntegrationService, apiVersion, type, ignoredInterfaces)); } - public ModuleApiDescriptionModel CreateSubModel(string[] controllers, string[] actions) + public ModuleApiDescriptionModel CreateSubModel(string[]? controllers, string[]? actions) { var subModel = Create(RootPath, RemoteServiceName); diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs index cf080a857e..a863d1bfad 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs @@ -6,32 +6,32 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ParameterApiDescriptionModel { - public string NameOnMethod { get; set; } + public string NameOnMethod { get; set; } = default!; - public string Name { get; set; } + public string Name { get; set; } = default!; - public string JsonName { get; set; } + public string? JsonName { get; set; } - public string Type { get; set; } + public string? Type { get; set; } - public string TypeSimple { get; set; } + public string? TypeSimple { get; set; } public bool IsOptional { get; set; } - public object DefaultValue { get; set; } + public object? DefaultValue { get; set; } - public string[] ConstraintTypes { get; set; } + public string[]? ConstraintTypes { get; set; } - public string BindingSourceId { get; set; } + public string? BindingSourceId { get; set; } - public string DescriptorName { get; set; } + public string? DescriptorName { get; set; } public ParameterApiDescriptionModel() { } - public static ParameterApiDescriptionModel Create(string name, string jsonName, string nameOnMethod, Type type, bool isOptional = false, object defaultValue = null, string[] constraintTypes = null, string bindingSourceId = null, string descriptorName = null) + public static ParameterApiDescriptionModel Create(string name, string? jsonName, string nameOnMethod, Type type, bool isOptional = false, object? defaultValue = null, string[]? constraintTypes = null, string? bindingSourceId = null, string? descriptorName = null) { return new ParameterApiDescriptionModel { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs index bd3852098b..03aca1fc29 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs @@ -9,13 +9,13 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class PropertyApiDescriptionModel { - public string Name { get; set; } + public string Name { get; set; } = default!; - public string JsonName { get; set; } + public string? JsonName { get; set; } - public string Type { get; set; } + public string Type { get; set; } = default!; - public string TypeSimple { get; set; } + public string TypeSimple { get; set; } = default!; public bool IsRequired { get; set; } @@ -23,11 +23,11 @@ public class PropertyApiDescriptionModel public int? MaxLength { get; set; } - public string Minimum { get; set; } + public string? Minimum { get; set; } - public string Maximum { get; set; } + public string? Maximum { get; set; } - public string Regex { get; set; } + public string? Regex { get; set; } public static PropertyApiDescriptionModel Create(PropertyInfo propertyInfo) { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs index 675eab3c82..e5a7e120a8 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs @@ -7,9 +7,9 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class ReturnValueApiDescriptionModel { - public string Type { get; set; } + public string Type { get; set; } = default!; - public string TypeSimple { get; set; } + public string TypeSimple { get; set; } = default!; public ReturnValueApiDescriptionModel() { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs index 6a9faa71d7..eaeb02f002 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs @@ -7,17 +7,17 @@ namespace Volo.Abp.Http.Modeling; [Serializable] public class TypeApiDescriptionModel { - public string BaseType { get; set; } + public string? BaseType { get; set; } public bool IsEnum { get; set; } - public string[] EnumNames { get; set; } + public string[]? EnumNames { get; set; } - public object[] EnumValues { get; set; } + public object[]? EnumValues { get; set; } - public string[] GenericArguments { get; set; } + public string[]? GenericArguments { get; set; } - public PropertyApiDescriptionModel[] Properties { get; set; } + public PropertyApiDescriptionModel[]? Properties { get; set; } public TypeApiDescriptionModel() { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs index 86449c8971..eb8ee307b5 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs @@ -5,7 +5,7 @@ namespace Volo.Abp.Http.ProxyScripting.Configuration; public static class AbpApiProxyScriptingConfiguration { - public static Func PropertyNameGenerator { get; set; } + public static Func PropertyNameGenerator { get; set; } static AbpApiProxyScriptingConfiguration() { diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs index f7383f0465..b5973eed8a 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs @@ -135,16 +135,16 @@ public class JQueryProxyScriptGenerator : IProxyScriptGenerator, ITransientDepen private static string FindBestApiVersion(ActionApiDescriptionModel action) { //var configuredVersion = GetConfiguredApiVersion(); //TODO: Implement - string configuredVersion = null; + string? configuredVersion = null; if (action.SupportedVersions.IsNullOrEmpty()) { return configuredVersion ?? "1.0"; } - if (action.SupportedVersions.Contains(configuredVersion)) + if (action.SupportedVersions!.Contains(configuredVersion!)) { - return configuredVersion; + return configuredVersion!; } return action.SupportedVersions.Last(); //TODO: Ensure to get the latest version! diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs index 4b43eb70c7..40cc5c4719 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs @@ -25,7 +25,7 @@ internal static class ProxyScriptingHelper } } - public static string GenerateHeaders(ActionApiDescriptionModel action, int indent = 0) + public static string? GenerateHeaders(ActionApiDescriptionModel action, int indent = 0) { var parameters = action .Parameters @@ -40,7 +40,7 @@ internal static class ProxyScriptingHelper return ProxyScriptingJsFuncHelper.CreateJsObjectLiteral(parameters, indent); } - public static string GenerateBody(ActionApiDescriptionModel action) + public static string? GenerateBody(ActionApiDescriptionModel action) { var parameters = action .Parameters @@ -62,7 +62,7 @@ internal static class ProxyScriptingHelper return ProxyScriptingJsFuncHelper.GetParamNameInJsFunc(parameters[0]); } - public static string GenerateFormPostData(ActionApiDescriptionModel action, int indent = 0) + public static string? GenerateFormPostData(ActionApiDescriptionModel action, int indent = 0) { var parameters = action .Parameters diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs index b165977076..e3eecb0f60 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs @@ -8,11 +8,11 @@ public class ProxyScriptingModel public bool UseCache { get; set; } - public string[] Modules { get; set; } + public string[]? Modules { get; set; } - public string[] Controllers { get; set; } + public string[]? Controllers { get; set; } - public string[] Actions { get; set; } + public string[]? Actions { get; set; } public IDictionary Properties { get; set; }