From 95c2b71c78ae9678bd02b73a6665d850cc964d94 Mon Sep 17 00:00:00 2001 From: Maxime Levillain Date: Tue, 22 Oct 2024 10:28:28 +0200 Subject: [PATCH] fix service name missing in ppx --- src/ppx/ppx_common.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ppx/ppx_common.ml b/src/ppx/ppx_common.ml index 043930b..944c7cd 100644 --- a/src/ppx/ppx_common.ml +++ b/src/ppx/ppx_common.ml @@ -229,9 +229,12 @@ let service_expr ?name ?options ?(parse_options=true) ~meth ~loc p = match name with | None -> Location.raise_errorf ~loc "service doesn't have a name" | Some name -> + let options_name = match options.name.pexp_desc with + | Pexp_construct ({txt=Lident "None"; _}, _) -> [%expr Some [%e estring ~loc name]] + | _ -> options.name in let expr = pexp_apply ~loc (evar ~loc "EzAPI.raw_service") [ Optional "section", options.section; - Optional "name", options.name; + Optional "name", options_name; Optional "descr", options.descr; Optional "params", options.params; Labelled "meth", meth;