diff --git a/src/lib_data_encoding/data_encoding.mli b/src/lib_data_encoding/data_encoding.mli index aee7b803c..1b28409b3 100644 --- a/src/lib_data_encoding/data_encoding.mli +++ b/src/lib_data_encoding/data_encoding.mli @@ -559,7 +559,7 @@ module Json: sig val convert : 'a Encoding.t -> 'a Json_encoding.encoding (** Generate a schema from an {!encoding}. *) - val schema : 'a Encoding.t -> schema + val schema : ?definitions_path:string -> 'a Encoding.t -> schema (** Construct a JSON object from an encoding. *) val construct : 't Encoding.t -> 't -> json diff --git a/src/lib_data_encoding/json.ml b/src/lib_data_encoding/json.ml index 116126db9..e605bf797 100644 --- a/src/lib_data_encoding/json.ml +++ b/src/lib_data_encoding/json.ml @@ -296,7 +296,7 @@ include Json_encoding let construct e v = construct (get_json e) v let destruct e v = destruct (get_json e) v -let schema e = schema (get_json e) +let schema ?definitions_path e = schema ?definitions_path (get_json e) let cannot_destruct fmt = Format.kasprintf diff --git a/src/lib_data_encoding/json.mli b/src/lib_data_encoding/json.mli index 76c78b26c..8ba9a80b7 100644 --- a/src/lib_data_encoding/json.mli +++ b/src/lib_data_encoding/json.mli @@ -37,7 +37,7 @@ type t = json type schema = Json_schema.schema val convert : 'a Encoding.t -> 'a Json_encoding.encoding -val schema : 'a Encoding.t -> schema +val schema : ?definitions_path:string -> 'a Encoding.t -> schema val encoding: json Encoding.t val schema_encoding: schema Encoding.t val construct : 't Encoding.t -> 't -> json diff --git a/src/lib_protocol_environment/sigs/v1/data_encoding.mli b/src/lib_protocol_environment/sigs/v1/data_encoding.mli index 67582dbd1..68c8b6ac4 100644 --- a/src/lib_protocol_environment/sigs/v1/data_encoding.mli +++ b/src/lib_protocol_environment/sigs/v1/data_encoding.mli @@ -220,7 +220,7 @@ val apply_lazy : module Json : sig - val schema : 'a encoding -> json_schema + val schema : ?definitions_path:string -> 'a encoding -> json_schema val construct : 't encoding -> 't -> json val destruct : 't encoding -> json -> 't diff --git a/src/lib_rpc/RPC_encoding.ml b/src/lib_rpc/RPC_encoding.ml index 0cb29c981..40bc43cc9 100644 --- a/src/lib_rpc/RPC_encoding.ml +++ b/src/lib_rpc/RPC_encoding.ml @@ -28,8 +28,8 @@ type schema = Data_encoding.json_schema * Data_encoding.Binary_schema.t let unit = Data_encoding.empty let untyped = Data_encoding.(obj1 (req "untyped" string)) let conv f g t = Data_encoding.conv ~schema:(Data_encoding.Json.schema t) f g t -let schema t = - (Data_encoding.Json.schema t, +let schema ?definitions_path t = + (Data_encoding.Json.schema ?definitions_path t, Data_encoding.Binary.describe t) let schema_encoding = diff --git a/vendors/ocplib-resto/lib_resto/resto.ml b/vendors/ocplib-resto/lib_resto/resto.ml index 51a5a57d6..c463b25c6 100644 --- a/vendors/ocplib-resto/lib_resto/resto.ml +++ b/vendors/ocplib-resto/lib_resto/resto.ml @@ -539,7 +539,7 @@ module type ENCODING = sig val unit : unit t val untyped : string t val conv : ('a -> 'b) -> ('b -> 'a) -> 'b t -> 'a t - val schema : 'a t -> schema + val schema : ?definitions_path:string -> 'a t -> schema val description_request_encoding : Description.request t val description_answer_encoding : schema Description.directory t end diff --git a/vendors/ocplib-resto/lib_resto/resto.mli b/vendors/ocplib-resto/lib_resto/resto.mli index c01dd6c9e..6efac8979 100644 --- a/vendors/ocplib-resto/lib_resto/resto.mli +++ b/vendors/ocplib-resto/lib_resto/resto.mli @@ -252,7 +252,7 @@ module type ENCODING = sig val unit : unit t val untyped : string t val conv : ('a -> 'b) -> ('b -> 'a) -> 'b t -> 'a t - val schema : 'a t -> schema + val schema : ?definitions_path:string -> 'a t -> schema val description_request_encoding : Description.request t val description_answer_encoding : schema Description.directory t end