File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ let do_request ~handler request =
4848 |> function | Ok v -> v | Error e -> failwith (Printf. sprintf " Could not reply request: %s" (Ocaml_protoc_plugin.Result. show_error e))
4949
5050let () =
51+ let name = Echo.Echo. package_service_name in
5152 let request = mk_request () in
5253 let reply = do_request ~handler: handle_request request in
53- Printf. printf " Reply: %s\n " reply
54+ Printf. printf " Reply to %s : %s\n " name reply
Original file line number Diff line number Diff line change @@ -147,11 +147,19 @@ let emit_service_type ~scope ~comment_db ~type_db ServiceDescriptorProto.{ name;
147147
148148 let proto_path = Scope. get_proto_path scope in
149149 let ocaml_service_name = Type_db. get_service type_db ~proto_path name in
150+ let package_service_name =
151+ match String. split_on_char ~sep: '.' proto_path with
152+ | [] | "" :: [] -> name
153+ | "" :: packages | packages ->
154+ (String. concat ~sep: " ." packages) ^ " ." ^ name
155+ in
150156 let signature = Code. init () in
151157 let implementation = Code. init () in
152158 Code. emit_comment ~position: `Leading signature (Comment_db. get_service_comments comment_db ~proto_path ~name );
153159 Code. emit signature `Begin " module %s : sig" ocaml_service_name;
154160 Code. emit implementation `Begin " module %s = struct" ocaml_service_name;
161+ Code. emit signature `None " val package_service_name : string" ;
162+ Code. emit implementation `None {| let package_service_name = " %s" | } package_service_name;
155163
156164 List. iter ~f: (emit_method ~scope: (Scope. push scope name) ~type_db signature implementation name) methods;
157165 Code. emit signature `End " end%s" (Code. append_deprecaton_if ~deprecated `Item " " );
You can’t perform that action at this time.
0 commit comments