From 199afd071a40b21302044d9f5dd1fec4ca5668ab Mon Sep 17 00:00:00 2001 From: Nicolas BACQUEY Date: Thu, 7 Jul 2022 15:13:34 +0200 Subject: [PATCH] Lib_openapi: remove Json value from Api.arg This commit removes the field "json" of type `Json.t` from type `Api.arg` in `lib_openapi`. This value contained a Json representation of the argument, which was no longer used. This has the additional benefit of removing the spurious `expected path /foo/bar but found /foo/bar` warning messages that happened when runnning the tests un `qcheck_rpc.ml`. Indeed, those only happened because two paths had two args with two `json` values that were slightly different. --- src/lib_openapi/api.ml | 9 +-------- src/lib_openapi/convert.ml | 1 - 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/lib_openapi/api.ml b/src/lib_openapi/api.ml index 9b1f4b36d5ec..9ed20247318e 100644 --- a/src/lib_openapi/api.ml +++ b/src/lib_openapi/api.ml @@ -35,13 +35,7 @@ let fail x = Printf.ksprintf failwith x (* First, we parse up to services. *) -type arg = { - json : Json.t; - (* arg as JSON, used by rpcdiff; we could remove this *) - id : string; - name : string; - descr : string option; -} +type arg = {id : string; name : string; descr : string option} type 'a tree = Static of 'a static | Dynamic of Json.t @@ -67,7 +61,6 @@ let opt_mandatory name json = function let parse_arg (json : Json.t) : arg = Json.as_record json @@ fun get -> { - json; id = get "id" |> opt_mandatory "id" json |> Json.as_string; name = get "name" |> opt_mandatory "name" json |> Json.as_string; descr = get "descr" |> Option.map Json.as_string; diff --git a/src/lib_openapi/convert.ml b/src/lib_openapi/convert.ml index d485f17514ba..5c43cb4fa216 100644 --- a/src/lib_openapi/convert.ml +++ b/src/lib_openapi/convert.ml @@ -283,7 +283,6 @@ let convert_service expected_path expected_method "expected method %s but found %s" (Method.to_http_string expected_method) (Method.to_http_string meth) ; - (* TODO: in practice [expected_path <> path]. Investigate why. *) if expected_path <> path then warn "expected path %s but found %s" -- GitLab