Browse Source

* Correctly get callback type

Michaël Van Canneyt 8 months ago
parent
commit
7148866f8d
1 changed files with 14 additions and 1 deletions
  1. 14 1
      packages/fcl-openapi/src/fpopenapi.pascaltypes.pp

+ 14 - 1
packages/fcl-openapi/src/fpopenapi.pascaltypes.pp

@@ -104,6 +104,7 @@ type
     function GetParam(aIndex : Integer): TAPIServiceMethodParam;
     function GetParamCount: Integer;
     function GetRequestBodyType: String;
+    function GetResultCallbackType: String;
     function GetResultType(AIndex: TNameType): String;
   protected
     // override this if you want to subclass the parameter
@@ -136,7 +137,7 @@ type
     // Component result Dto type
     Property ResultDtoType : String index ntPascal Read GetResultType;
     // Callback type for result.
-    Property ResultCallBackType : String Read FResultCallbackType write FResultCallBackType;
+    Property ResultCallBackType : String Read GetResultCallbackType write FResultCallBackType;
     // OpenAPI Operation for this method.
     Property Operation : TApiOperation Read FOperation;
     // Pascal name for the method.
@@ -495,6 +496,18 @@ begin
     Result:='';
 end;
 
+function TAPIServiceMethod.GetResultCallbackType: String;
+begin
+  Result:=FResultCallbackType;
+  if Result='' then
+    begin
+    Result:=ResultType;
+    if Result='' then
+      Result:='VoidResult';
+    Result:='T'+Result+'CallBack';
+    end;
+end;
+
 function TAPIServiceMethod.GetResultType(AIndex: TNameType): String;
 begin
   if assigned(FResultDataType) then