type items = item list are now supported. A wrapper class (e.g. Items) implementing Atdj is generated with the same interface as record classes: a no-arg constructor, a constructor from ArrayList<T>, a constructor from a JSON string, a package-private constructor from JSONArray, toJsonBuffer, toJson, and a public value field of type ArrayList<T>. List aliases used as record fields or sum-variant payloads are also handled correctly.jsonlike_of_foo serializer functions and Foo.to_jsonlike submodule bindings, completing the OCaml ↔ Atd_jsonlike.AST.t round-trip. JSON adapters are also supported: if the adapter module M provides restore_jsonlike, it is called after serialization by jsonlike_of_foo.Pos.zero and Loc.zero — zero-position / zero-location constants useful for constructing AST.t nodes programmatically when source location information is not available.to_yamlx_value : Atd_jsonlike.AST.t -> YAMLx.value, the reverse of of_yamlx_value. Enables programmatic construction of YAML documents from ATD-typed OCaml values via jsonlike_of_foo.yamlx dependency of atd-yamlx.standard-tests/) that any code generator can opt into. The harness generates code from an ATD spec, compiles it, feeds JSON to stdin, and checks the output. atdml is the first backend to run these tests.New package: atd-yamlx. Translates a parsed YAML value (YAMLx.value from the yamlx library) into Atd_jsonlike.AST.t, preserving source locations at every node so that ATD-generated reader functions (foo_of_jsonlike) can report precise file/line/column error messages when deserializing YAML configuration files.
of_yamlx_value returns (AST.t, string) result; the raising variant is of_yamlx_value_exn.atd-yamlx/examples/ is a self-contained dune subproject demonstrating a typed YAML config reader built with atdml and atd-yamlx.<json repr="object"> on sum types. Tagged variants are encoded as single-key JSON objects {"Constructor": payload} instead of the default ["Constructor", payload] arrays. Unit variants are unaffected ("Constructor" strings). This matches Serde's externally-tagged representation and produces idiomatic YAML (a single-key mapping rather than a two-element sequence). Supported in: atdml (OCaml), atdpy (Python), atdts (TypeScript), atdcpp (C++), atdd (D), atdj (Java), atds (Scala). atdml additionally generates of_jsonlike readers automatically.atd-jsonlike. Defines a generic JSON-like AST (Atd_jsonlike.AST.t) with source location information at every node. Intended as a target type for code generated by ATD tools, so that reader functions can report precise file/line/column error messages. Supports JSON numbers via Atd_jsonlike.Number.t, which stores all available representations (int, float, and literal string) for maximum flexibility.atdml: Generate foo_of_jsonlike reader functions that accept an Atd_jsonlike.AST.t value and return a typed OCaml value, with error messages that include the original source location.
atd-jsonlike dependency unless explicitly requested).--mode MODE option (repeatable) selects what to generate. MODE is a mode name or comma-separated list of mode names. Valid modes: yojson, jsonlike, all (= yojson + jsonlike). Example: atdml --mode yojson,jsonlike foo.atd<json adapter.ocaml="M">) are supported for the jsonlike path: if the adapter module M provides normalize_jsonlike, it is called before deserialization by foo_of_jsonlike. Inline adapters (adapter.to_ocaml/adapter.from_ocaml) do not support jsonlike.cat.ATD: Experimental. Module support via new from ... import ... syntax. Types to be used must be listed explicitly; the full syntax is:
from module.path <annots> [as alias] import type1 <annots>, type2, ...Key properties:
from mylib import date, status).from mylib import 'a list_ne.from foo as f import t.<python name="..."> for atdpy, <ts name="..."> for atdts, <ocaml name="..."> for atdml._ (e.g. alias class → class_ in generated code).import declarations are now mapped to path-separator form in the generated TypeScript import path. For example, import long.module.path generates import * as path from "./long/module/path" rather than "./path".Examples:
(* Import specific types from a module *)
from mylib.common import date, status
(* Import with alias *)
from long.module.path as ext import tag
(* Override OCaml module name *)
from mylib.common <ocaml name="Mylib_common"> import dateatdml: Experimental. New tool. Generates a single self-contained OCaml module (.ml + .mli) from a single .atd file, with JSON support via Yojson.Safe.t. No separate runtime library is required; the runtime helpers are inlined into each generated .ml. Atdml is the recommended successor to atdgen for OCaml JSON support. Supported features:
unit, bool, int, float, stringabstract type, represented as Yojson.Safe.t'a list, 'a option, 'a nullable('a * 'b * ...)?foo), and with-default fields (~foo) with implicit or explicit defaults (<ocaml default="...">)<ocaml field_prefix="pre_"> on record types: prepends the given prefix to all OCaml record field names while keeping the labeled arguments of create_ unprefixed (e.g. create_point ~x ~y () : point). JSON field names are unaffected.<ocaml repr="poly">)and is used only when strictly necessary)wrap construct with <ocaml module="M"> or explicit <ocaml t="..." wrap="..." unwrap="..."><json adapter.ocaml="M"> (module providing normalize and restore) or <json adapter.to_ocaml="..." adapter.from_ocaml="..."> (inline expressions); supported on sum types and records<json name="..."> to override JSON field or constructor names<ocaml name="..."> to rename variant constructors in OCaml<ocaml attr="..."> to attach ppx attributes (e.g. [@@deriving show]) to generated type definitions<ocaml private> on any type definition forces private in the generated .mli; <ocaml public> on a primitive alias suppresses the default private, making the alias transparent to callersunit, bool, int, float, string) are generated as private in the .mli, preventing direct construction outside the module. A constructor function create_email : string -> email is generated (also exposed as val create in submodule Email). Coerce back with :> (e.g. (x :> string)).<doc text="..."> documentation annotations, translated into ocamldoc (** ... *) comments in the generated code; supported on type definitions, record fields, variant constructors, and module-level head annotationsfoo_of_yojson/yojson_of_foo naming schemeend → end_)(string * 'a) list <json repr="object">: encode association lists as JSON objects {"key": value, ...} rather than arrays<ocaml module="..."> on type definitions and <ocaml name="..."> on record fields emit a warning and are otherwise ignored~field: user_type with no OCaml default: warns and treats the field as required in JSON (no create_ function generated for that type)create_foo (not make_foo), matching atdgen's conventionmodule type Types = sig ... end / module Types : Types = struct ... end snippet to stdoutmodule Foo) bundling the type and its conversion functions-j-std now implies -j like before to avoid breaking existing uses. A warning is now also printed to encourage migration (#443)-j-gen-modules to generate JSON generic submodules (#420)<ts from...> annotations<doc text=...> annotations, turning them into docstrings similar to the ocamldoc comments produced by atdgen.-j-std, now it's the default, one cannot generate extended-JSON (#425). Options -j-std and -std-json are still available as backward-compatibility no-ops unless environment variable ATDGEN_FAIL_DEPRECATED_OPTIONS is set to true in which case their use results in an exception.alias this syntax.<json open_enum> in Melange (#401)double c++ type as default floating point type (#411)atdgen library is no longer available. Use atdgen-runtime instead (#421)--ignore option is now available. It makes atddiff fail if some types are neither selected via --types nor ignored via --ignore.atddiff --version output (#379)--no-locations aimed at producing more stable results that allow diffing successive atddiff reports to spot new findings and ignore old ones (#377).d files now have the suffix _atd.d (#355)--backward, --forward) or based on the name of the affected types (--types) (#365)--output-format json for exporting the results to JSON (#360)wrap constructs (#353)-remove-wraps which pretty-prints the type definitions without wrap constructs (#353)dlang backend to generate D code from ATD definitions (#349)atd package together with atdcat (#352, #358)Optional) to make things simpler for Python programmers. This prevents distinguishing ["Some", "None"] from "None" which both translate to None in Python. (#332)<json repr="string"> for int values (#330)abstract.foo?: int.type Int = number since it was more confusing than helpful. Occurrences of Int are replaced by number /*int*/.abstract type validation to accept all input by default (#301)<json adapter.to_ocaml="..." adapter.from_ocaml="..."> (#184).-jsonschema-no-additional-properties for JSON Schema output to specify that JSON objects may not have extra properties (#293, #294).title field to JSON Schema output containing the name of root type (#294).abstract built-in can now be used like any other type to hold untyped data, if the implementation supports it. The supported targets so far are OCaml/JSON (atdgen), Python (atdpy), TypeScript (atdts), JSON Schema (atdcat) (#295).-jsonschema to translate from ATD to JSON Schema (#284)atdpy --version print the version of atdpy itself rather than the version of the atd library (#270)nullable and improve error message on option types used without optional fields (#277)@dataclass decorator twice if explicitly added by the user via an ATD annotation such as <python decorator="dataclass(frozen=True)"> (#267)<ocaml field_prefix=...> and a few others (#258)<ocaml from="ProtoA"><ocaml predef>)<json adapter.ocaml=...>)<json open_enum>)<json tag_field=...> and <json untyped>atdgen-runtime package. This package contains the runtime dependency introduced by the atdgen code generator. The old runtime library is deprecatedatdj to set of released packages. atdj is a java code generator for .atd files.Ag_version submodule has been replaced with Version.atd aliases using the (wrapped true) mode of jbuilder. This is a breaking change for all of those who use atd the library. All modules are now accessible under the Atd. entry module.