Browse Source

Enable nullable annotations for Volo.Abp.Http

pull/17560/head
liangshiwei 3 years ago
parent
commit
95ae085c20
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
  2. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs
  3. 2
      framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj
  4. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs
  5. 20
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs
  6. 16
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApiTypeNameHelper.cs
  7. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs
  8. 20
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs
  9. 8
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs
  10. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs
  11. 12
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs
  12. 12
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs
  13. 20
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs
  14. 14
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs
  15. 4
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs
  16. 10
      framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs
  17. 2
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Configuration/AbpApiProxyScriptingConfiguration.cs
  18. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs
  19. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs
  20. 6
      framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs

@ -145,7 +145,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide
ActionApiDescriptionModel.Create( ActionApiDescriptionModel.Create(
uniqueMethodName, uniqueMethodName,
method, method,
apiDescription.RelativePath, apiDescription.RelativePath!,
apiDescription.HttpMethod, apiDescription.HttpMethod,
GetSupportedVersions(controllerType, method, setting), GetSupportedVersions(controllerType, method, setting),
allowAnonymous, allowAnonymous,

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ProxyScripting/ServiceProxyGenerationModel.cs

@ -32,7 +32,7 @@ public class ServiceProxyGenerationModel
public ProxyScriptingModel CreateOptions() public ProxyScriptingModel CreateOptions()
{ {
var options = new ProxyScriptingModel(Type, UseCache); var options = new ProxyScriptingModel(Type!, UseCache);
if (!Modules.IsNullOrEmpty()) if (!Modules.IsNullOrEmpty())
{ {

2
framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj

@ -5,6 +5,8 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> <TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<Nullable>enable</Nullable>
<WarningsAsErrors>Nullable</WarningsAsErrors>
<AssemblyName>Volo.Abp.Http</AssemblyName> <AssemblyName>Volo.Abp.Http</AssemblyName>
<PackageId>Volo.Abp.Http</PackageId> <PackageId>Volo.Abp.Http</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

6
framework/src/Volo.Abp.Http/Volo/Abp/Http/HttpMethodHelper.cs

@ -43,12 +43,12 @@ public static class HttpMethodHelper
return methodName; 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": case "GET":
return HttpMethod.Get; return HttpMethod.Get;

20
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ActionApiDescriptionModel.cs

@ -10,32 +10,32 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class ActionApiDescriptionModel 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<string> SupportedVersions { get; set; } public IList<string>? SupportedVersions { get; set; }
public IList<MethodParameterApiDescriptionModel> ParametersOnMethod { get; set; } public IList<MethodParameterApiDescriptionModel> ParametersOnMethod { get; set; } = default!;
public IList<ParameterApiDescriptionModel> Parameters { get; set; } public IList<ParameterApiDescriptionModel> Parameters { get; set; } = default!;
public ReturnValueApiDescriptionModel ReturnValue { get; set; } public ReturnValueApiDescriptionModel ReturnValue { get; set; } = default!;
public bool? AllowAnonymous { get; set; } public bool? AllowAnonymous { get; set; }
public string ImplementFrom { get; set; } public string? ImplementFrom { get; set; }
public ActionApiDescriptionModel() public ActionApiDescriptionModel()
{ {
} }
public static ActionApiDescriptionModel Create([NotNull] string uniqueName, [NotNull] MethodInfo method, [NotNull] string url, [CanBeNull] string httpMethod, [NotNull] IList<string> supportedVersions, bool? allowAnonymous = null, string implementFrom = null) public static ActionApiDescriptionModel Create([NotNull] string uniqueName, [NotNull] MethodInfo method, [NotNull] string url, string? httpMethod, [NotNull] IList<string> supportedVersions, bool? allowAnonymous = null, string? implementFrom = null)
{ {
Check.NotNull(uniqueName, nameof(uniqueName)); Check.NotNull(uniqueName, nameof(uniqueName));
Check.NotNull(method, nameof(method)); Check.NotNull(method, nameof(method));

16
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 (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)) 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 (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)) 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)}]";
} }
} }

6
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ApplicationApiDescriptionModel.cs

@ -8,9 +8,9 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class ApplicationApiDescriptionModel public class ApplicationApiDescriptionModel
{ {
public IDictionary<string, ModuleApiDescriptionModel> Modules { get; set; } public IDictionary<string, ModuleApiDescriptionModel> Modules { get; set; } = default!;
public IDictionary<string, TypeApiDescriptionModel> Types { get; set; } public IDictionary<string, TypeApiDescriptionModel> Types { get; set; } = default!;
public ApplicationApiDescriptionModel() public ApplicationApiDescriptionModel()
{ {
@ -41,7 +41,7 @@ public class ApplicationApiDescriptionModel
return Modules.GetOrAdd(rootPath, () => ModuleApiDescriptionModel.Create(rootPath, remoteServiceName)); 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(); ; var subModel = ApplicationApiDescriptionModel.Create(); ;

20
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerApiDescriptionModel.cs

@ -8,28 +8,28 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class ControllerApiDescriptionModel 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 IsRemoteService { get; set; }
public bool IsIntegrationService { 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<ControllerInterfaceApiDescriptionModel> Interfaces { get; set; } public List<ControllerInterfaceApiDescriptionModel> Interfaces { get; set; } = default!;
public Dictionary<string, ActionApiDescriptionModel> Actions { get; set; } public Dictionary<string, ActionApiDescriptionModel> Actions { get; set; } = default!;
public ControllerApiDescriptionModel() public ControllerApiDescriptionModel()
{ {
} }
public static ControllerApiDescriptionModel Create(string controllerName, string groupName, bool isRemoteService, bool isIntegrationService, string apiVersion, Type type, [CanBeNull] HashSet<Type> ignoredInterfaces = null) public static ControllerApiDescriptionModel Create(string controllerName, string? groupName, bool isRemoteService, bool isIntegrationService, string? apiVersion, Type type, HashSet<Type>? ignoredInterfaces = null)
{ {
return new ControllerApiDescriptionModel return new ControllerApiDescriptionModel
{ {
@ -38,11 +38,11 @@ public class ControllerApiDescriptionModel
IsRemoteService = isRemoteService, IsRemoteService = isRemoteService,
IsIntegrationService = isIntegrationService, //IntegrationServiceAttribute.IsDefinedOrInherited(type), IsIntegrationService = isIntegrationService, //IntegrationServiceAttribute.IsDefinedOrInherited(type),
ApiVersion = apiVersion, ApiVersion = apiVersion,
Type = type.FullName, Type = type.FullName!,
Actions = new Dictionary<string, ActionApiDescriptionModel>(), Actions = new Dictionary<string, ActionApiDescriptionModel>(),
Interfaces = type Interfaces = type
.GetInterfaces() .GetInterfaces()
.WhereIf(ignoredInterfaces != null, i => !i.IsGenericType && !ignoredInterfaces.Contains(i)) .WhereIf(ignoredInterfaces != null, i => !i.IsGenericType && !ignoredInterfaces!.Contains(i))
.Select(ControllerInterfaceApiDescriptionModel.Create) .Select(ControllerInterfaceApiDescriptionModel.Create)
.ToList() .ToList()
}; };
@ -60,7 +60,7 @@ public class ControllerApiDescriptionModel
return Actions[uniqueName] = action; return Actions[uniqueName] = action;
} }
public ControllerApiDescriptionModel CreateSubModel(string[] actions) public ControllerApiDescriptionModel CreateSubModel(string[]? actions)
{ {
var subModel = new ControllerApiDescriptionModel var subModel = new ControllerApiDescriptionModel
{ {

8
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ControllerInterfaceApiDescriptionModel.cs

@ -8,11 +8,11 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class ControllerInterfaceApiDescriptionModel 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() public ControllerInterfaceApiDescriptionModel()
{ {
@ -23,7 +23,7 @@ public class ControllerInterfaceApiDescriptionModel
{ {
var model = new ControllerInterfaceApiDescriptionModel var model = new ControllerInterfaceApiDescriptionModel
{ {
Type = type.FullName, Type = type.FullName!,
Name = type.Name Name = type.Name
}; };

6
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/InterfaceMethodApiDescriptionModel.cs

@ -9,11 +9,11 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class InterfaceMethodApiDescriptionModel public class InterfaceMethodApiDescriptionModel
{ {
public string Name { get; set; } public string Name { get; set; } = default!;
public IList<MethodParameterApiDescriptionModel> ParametersOnMethod { get; set; } public IList<MethodParameterApiDescriptionModel> ParametersOnMethod { get; set; } = default!;
public ReturnValueApiDescriptionModel ReturnValue { get; set; } public ReturnValueApiDescriptionModel ReturnValue { get; set; } = default!;
public InterfaceMethodApiDescriptionModel() public InterfaceMethodApiDescriptionModel()
{ {

12
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/MethodParameterApiDescriptionModel.cs

@ -7,17 +7,17 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class MethodParameterApiDescriptionModel 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 bool IsOptional { get; set; }
public object DefaultValue { get; set; } public object? DefaultValue { get; set; }
public MethodParameterApiDescriptionModel() public MethodParameterApiDescriptionModel()
{ {
@ -28,7 +28,7 @@ public class MethodParameterApiDescriptionModel
{ {
return new MethodParameterApiDescriptionModel return new MethodParameterApiDescriptionModel
{ {
Name = parameterInfo.Name, Name = parameterInfo.Name!,
TypeAsString = parameterInfo.ParameterType.GetFullNameWithAssemblyName(), TypeAsString = parameterInfo.ParameterType.GetFullNameWithAssemblyName(),
Type = TypeHelper.GetFullNameHandlingNullableAndGenerics(parameterInfo.ParameterType), Type = TypeHelper.GetFullNameHandlingNullableAndGenerics(parameterInfo.ParameterType),
TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(parameterInfo.ParameterType), TypeSimple = ApiTypeNameHelper.GetSimpleTypeName(parameterInfo.ParameterType),

12
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs

@ -18,11 +18,11 @@ public class ModuleApiDescriptionModel
/// </summary> /// </summary>
public const string DefaultRemoteServiceName = "Default"; 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<string, ControllerApiDescriptionModel> Controllers { get; set; } public IDictionary<string, ControllerApiDescriptionModel> Controllers { get; set; } = default!;
public ModuleApiDescriptionModel() public ModuleApiDescriptionModel()
{ {
@ -49,13 +49,13 @@ public class ModuleApiDescriptionModel
return Controllers[controller.Type] = controller; return Controllers[controller.Type] = controller;
} }
public ControllerApiDescriptionModel GetOrAddController(string name, string groupName, bool isRemoteService, bool isIntegrationService, string apiVersion, Type type, [CanBeNull] HashSet<Type> ignoredInterfaces = null) public ControllerApiDescriptionModel GetOrAddController(string name, string? groupName, bool isRemoteService, bool isIntegrationService, string? apiVersion, Type type, HashSet<Type>? 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)); 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); var subModel = Create(RootPath, RemoteServiceName);

20
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs

@ -6,32 +6,32 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class ParameterApiDescriptionModel 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 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 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 return new ParameterApiDescriptionModel
{ {

14
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/PropertyApiDescriptionModel.cs

@ -9,13 +9,13 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class PropertyApiDescriptionModel 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; } public bool IsRequired { get; set; }
@ -23,11 +23,11 @@ public class PropertyApiDescriptionModel
public int? MaxLength { get; set; } 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) public static PropertyApiDescriptionModel Create(PropertyInfo propertyInfo)
{ {

4
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ReturnValueApiDescriptionModel.cs

@ -7,9 +7,9 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class ReturnValueApiDescriptionModel 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() public ReturnValueApiDescriptionModel()
{ {

10
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/TypeApiDescriptionModel.cs

@ -7,17 +7,17 @@ namespace Volo.Abp.Http.Modeling;
[Serializable] [Serializable]
public class TypeApiDescriptionModel public class TypeApiDescriptionModel
{ {
public string BaseType { get; set; } public string? BaseType { get; set; }
public bool IsEnum { 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() public TypeApiDescriptionModel()
{ {

2
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 class AbpApiProxyScriptingConfiguration
{ {
public static Func<PropertyInfo, string> PropertyNameGenerator { get; set; } public static Func<PropertyInfo, string?> PropertyNameGenerator { get; set; }
static AbpApiProxyScriptingConfiguration() static AbpApiProxyScriptingConfiguration()
{ {

6
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) private static string FindBestApiVersion(ActionApiDescriptionModel action)
{ {
//var configuredVersion = GetConfiguredApiVersion(); //TODO: Implement //var configuredVersion = GetConfiguredApiVersion(); //TODO: Implement
string configuredVersion = null; string? configuredVersion = null;
if (action.SupportedVersions.IsNullOrEmpty()) if (action.SupportedVersions.IsNullOrEmpty())
{ {
return configuredVersion ?? "1.0"; 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! return action.SupportedVersions.Last(); //TODO: Ensure to get the latest version!

6
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 var parameters = action
.Parameters .Parameters
@ -40,7 +40,7 @@ internal static class ProxyScriptingHelper
return ProxyScriptingJsFuncHelper.CreateJsObjectLiteral(parameters, indent); return ProxyScriptingJsFuncHelper.CreateJsObjectLiteral(parameters, indent);
} }
public static string GenerateBody(ActionApiDescriptionModel action) public static string? GenerateBody(ActionApiDescriptionModel action)
{ {
var parameters = action var parameters = action
.Parameters .Parameters
@ -62,7 +62,7 @@ internal static class ProxyScriptingHelper
return ProxyScriptingJsFuncHelper.GetParamNameInJsFunc(parameters[0]); 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 var parameters = action
.Parameters .Parameters

6
framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/ProxyScriptingModel.cs

@ -8,11 +8,11 @@ public class ProxyScriptingModel
public bool UseCache { get; set; } 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<string, string> Properties { get; set; } public IDictionary<string, string> Properties { get; set; }

Loading…
Cancel
Save