diff --git a/packages/fcl-web/src/jsonrpc/fpextdirect.pp b/packages/fcl-web/src/jsonrpc/fpextdirect.pp index 9a5d90ac2c..ca70408698 100644 --- a/packages/fcl-web/src/jsonrpc/fpextdirect.pp +++ b/packages/fcl-web/src/jsonrpc/fpextdirect.pp @@ -36,6 +36,9 @@ Type Function FindHandler(Const AClassName,AMethodName : TJSONStringType;AContext : TJSONRPCCallContext; Out FreeObject : TComponent) : TCustomJSONRPCHandler; override; // Add type field function CreateJSON2Error(Const AMessage : String; Const ACode : Integer; ID : TJSONData = Nil; idname : TJSONStringType = 'id' ) : TJSONObject; override; + // Create API method description + Function HandlerToAPIMethod (H: TCustomJSONRPCHandler): TJSONObject; virtual; + Function HandlerDefToAPIMethod (H: TJSONRPCHandlerDef): TJSONObject; virtual; // Create API Function DoAPI : TJSONData; virtual; // Namespace for API description. Must be set. Default 'FPWeb' @@ -209,6 +212,17 @@ begin TJSONObject(Result).Add('type','rpc'); end; +function TCustomExtDirectDispatcher.HandlerToAPIMethod(H: TCustomJSONRPCHandler): TJSONObject; +begin + Result:=TJSONObject.Create(['name',H.Name,'len',H.ParamDefs.Count]) +end; + +function TCustomExtDirectDispatcher.HandlerDefToAPIMethod(H: TJSONRPCHandlerDef + ): TJSONObject; +begin + Result:=TJSONObject.Create(['name',H.HandlerMethodName,'len',H.ArgumentCount]) +end; + function TCustomExtDirectDispatcher.DoAPI: TJSONData; Var @@ -242,7 +256,7 @@ begin A.Add(N,R); end; H:=Owner.Components[i] as TCustomJSONRPCHandler; - R.Add(TJSONObject.Create(['name',H.Name,'len',H.ParamDefs.Count])); + R.Add(HandlerToAPIMethod(H)); end; end; If (jdoSearchRegistry in Options) then @@ -266,7 +280,7 @@ begin else R:=A.Items[J] as TJSONArray; end; - R.Add(TJSONObject.Create(['name',HD.HandlerMethodName,'len',HD.ArgumentCount])); + R.Add(HandlerDefToAPIMethod(HD)); end; end; Result:=D;