package atd

  1. Overview
  2. Docs

Mapping from ATD to JSON

type ocaml_adapter = {
  1. normalize : string;
  2. restore : string;
}
type json_adapter = {
  1. ocaml_adapter : ocaml_adapter option;
    (*

    A module implementing normalize and restore.

    *)
  2. java_adapter : string option;
    (*

    tbd

    *)
}

Association between languages and json adapter for that language. The specification of each json adapter is language-specific.

val no_adapter : json_adapter
type json_int =
  1. | Int
  2. | String
type json_float =
  1. | Float of int option
  2. | Int
type json_list =
  1. | Array
  2. | Object
type json_variant = {
  1. json_cons : string;
}
type json_field = {
  1. json_fname : string;
  2. json_unwrapped : bool;
}
type json_record = {
  1. json_keep_nulls : bool;
  2. json_record_adapter : json_adapter;
}
type json_sum = {
  1. json_sum_adapter : json_adapter;
  2. json_open_enum : bool;
}
type json_repr =
  1. | Abstract
  2. | Bool
  3. | Cell
  4. | Def
  5. | External
  6. | Field of json_field
  7. | Float of json_float
  8. | Int of json_int
  9. | List of json_list
  10. | Nullable
  11. | Option
  12. | Record of json_record
  13. | String
  14. | Sum of json_sum
  15. | Tuple
  16. | Unit
  17. | Variant of json_variant
  18. | Wrap

The different kinds of ATD nodes with their json-specific options.

val annot_schema_json : Annot.schema
val get_json_list : Annot.t -> json_list
val is_json_map : Ast.type_expr -> bool
val get_json_float : Annot.t -> json_float
val get_json_int : Annot.t -> json_int
val get_json_cons : string -> Annot.t -> string
val get_json_fname : string -> Annot.t -> string
val get_json_record : Annot.t -> json_record
val get_json_sum : Annot.t -> json_sum
OCaml

Innovation. Community. Security.