Mavryk_openapi.Json
Helpers to read JSON values.
Contains functions to parse JSON values, show them for debugging, and extract information from them.
Functions which extract information are rather strict: they don't try to be smart and automatically convert. For instance, as_record
makes sure that all fields are taken into account. This is suited to write a tool that must be updated when the format of JSON values being manipulated changes. In our case, if the JSON schemas we read start to get more fields, we want to know; otherwise the resulting OpenAPI specification could be inaccurate.
include module type of struct include JSON end
val show_error : error -> string
exception Error of error
val error : t -> ('a, unit, string, 'b) Stdlib.format4 -> 'a
val encode : t -> string
val encode_u : u -> string
val encode_to_file : string -> t -> unit
val encode_to_file_u : string -> u -> unit
val parse_file : string -> t
val parse : origin:string -> string -> t
val parse_opt : origin:string -> string -> t option
val is_null : t -> bool
val as_bool : t -> bool
val as_bool_opt : t -> bool option
val is_bool : t -> bool
val as_int : t -> int
val as_int_opt : t -> int option
val is_int : t -> bool
val as_int64 : t -> int64
val as_int64_opt : t -> int64 option
val is_int64 : t -> bool
val as_int32 : t -> int32
val as_int32_opt : t -> int32 option
val is_int32 : t -> bool
val as_float : t -> float
val as_float_opt : t -> float option
val is_float : t -> bool
val as_string : t -> string
val as_string_opt : t -> string option
val is_string : t -> bool
val is_list : t -> bool
val is_object : t -> bool