Doc: less unnamed fields in binary description

This commit is contained in:
Grégoire Henry 2018-06-01 00:05:59 +02:00 committed by Benjamin Canou
parent 5baa090a1e
commit c82b44e8f2
4 changed files with 13 additions and 9 deletions

View File

@ -54,8 +54,11 @@ let encoding =
let open Data_encoding in
def "fitness"
~title: "Fitness"
~description: "... FIXME ..."
(list (def "fitness.elem" bytes))
~description: "... FIXME ..." @@
splitted
~json: (list bytes)
~binary:
(list (def "fitness.elem" bytes))
let to_bytes v = Data_encoding.Binary.to_bytes_exn encoding v
let of_bytes b = Data_encoding.Binary.of_bytes encoding b

View File

@ -101,7 +101,7 @@ module MakeEncoder(H : sig
let open Data_encoding in
splitted
~binary:
H.raw_encoding
(obj1 (req H.name H.raw_encoding))
~json:
(def H.name
~title: (H.title ^ " (Base58Check-encoded)") @@

View File

@ -215,8 +215,8 @@ let describe (type x) (encoding : x Encoding.t) =
and obj fields =
Binary_schema.Obj { fields }
and union :
type a. recursives -> references -> Kind.t -> Binary_size.tag_size -> a case list -> string * references=
fun recursives references kind size cases ->
type a. string option -> recursives -> references -> Kind.t -> Binary_size.tag_size -> a case list -> string * references=
fun ref_name recursives references kind size cases ->
let cases =
List.sort (fun (t1, _) (t2, _) -> Compare.Int.compare t1 t2) @@
TzList.filter_map
@ -233,7 +233,7 @@ let describe (type x) (encoding : x Encoding.t) =
((tag, Some case.title, tag_field :: fields) :: cases, references))
cases
([], references) in
let name = new_reference () in
let name = may_new_reference ref_name in
let references =
add_reference
name
@ -327,7 +327,7 @@ let describe (type x) (encoding : x Encoding.t) =
fields None recursives references right.encoding in
(fields1 @ fields2, references)
| Union { kind ; tag_size ; cases } ->
let name, references = union recursives references kind tag_size cases in
let name, references = union None recursives references kind tag_size cases in
([ Anonymous_field (kind, Ref name) ], references)
| (Mu { kind ; name ; title ; description ; fix } as encoding) ->
let kind = (kind :> Kind.t) in
@ -459,8 +459,7 @@ let describe (type x) (encoding : x Encoding.t) =
let references = add_reference name (obj fields) references in
(Ref name, references)
| Union { kind ; tag_size ; cases } ->
(* FIXMe ref_name ?? *)
let name, references = union recursives references kind tag_size cases in
let name, references = union ref_name recursives references kind tag_size cases in
(Ref name, references)
| Mu { name ; title ; description ; fix } as encoding ->
let title = Option.unopt ~default:name title in

View File

@ -335,6 +335,7 @@ module Encoding = struct
| Single o -> o in
let of_list : Kind.endorsements contents -> _ = function
| o -> Single o in
def "inlined.endorsement" @@
conv
(fun ({ shell ; protocol_data = { contents ; signature } } : _ operation)->
(shell, (contents, signature)))
@ -345,6 +346,7 @@ module Encoding = struct
(obj2
(req "operations"
(conv to_list of_list @@
def "inlined.endorsement.contents" @@
union [
make endorsement_case ;
]))