Update to the latest ocplib-json-typed.

This commit is contained in:
Benjamin Canou 2016-11-08 16:35:53 +01:00
parent 2371ad7135
commit 6f2c880627

View File

@ -32,10 +32,20 @@ type input = {
let fill_in input schema = let fill_in input schema =
let rec element path { title ; kind }= let rec element path { title ; kind }=
match kind with match kind with
| Integer -> | Integer { minimum ; maximum } ->
input.int 0 (1 lsl 30 - 1) title path >>= fun i -> let minimum =
match minimum with
| None -> min_int
| Some (m, `Inclusive) -> int_of_float m
| Some (m, `Exclusive) -> int_of_float m + 1 in
let maximum =
match maximum with
| None -> max_int
| Some (m, `Inclusive) -> int_of_float m
| Some (m, `Exclusive) -> int_of_float m - 1 in
input.int minimum maximum title path >>= fun i ->
return (`Float (float i)) return (`Float (float i))
| Number -> | Number _ ->
input.float title path >>= fun f -> input.float title path >>= fun f ->
return (`Float f) return (`Float f)
| Boolean -> | Boolean ->
@ -51,8 +61,6 @@ let fill_in input schema =
| Combine ((All_of | Not), _) -> fail Unsupported_construct | Combine ((All_of | Not), _) -> fail Unsupported_construct
| Def_ref name -> | Def_ref name ->
return (`String (Json_query.json_pointer_of_path name)) return (`String (Json_query.json_pointer_of_path name))
(* (try element path (find_definition name schema)
with Not_found -> fail Erroneous_construct) *)
| Id_ref _ | Ext_ref _ -> | Id_ref _ | Ext_ref _ ->
fail Unsupported_construct fail Unsupported_construct
| Array (elts, _) -> | Array (elts, _) ->