Organisationsahrefsatd

atd

https://github.com/ahrefs/atd
Branches (2)
martin/json-ast
atdml: support normalize_jsonlike in module-based JSON adapters When <json adapter.ocaml="M"> is used, of_jsonlike now calls M.normalize_jsonlike before deserialization, mirroring the M.normalize call in of_yojson. The function name is intentionally different to avoid conflicts with the Yojson adapter interface. Only module-based adapters are supported for jsonlike; inline adapters (adapter.to_ocaml / adapter.from_ocaml) are not supported and continue to be silently skipped for the jsonlike path. Implementation: the mode record's supports_json_adapters:bool field is replaced with normalize_of_adapter:(json_adapter -> string option), so each mode knows how to derive its normalize expression from an adapter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
203aee
martin/yaml-friendly-variants
atdml: add <json repr="object"> for sum types (externally-tagged encoding) Tagged variants are now encoded as single-key JSON objects {"Constructor": payload} when the sum type is annotated with <json repr="object">. Unit variants remain "Constructor" strings. This matches Serde's externally-tagged representation. Both of_yojson and of_jsonlike readers are generated. The yojson writer (yojson_of_*) also produces the object encoding. Implementation: - atd/src/json.ml,mli: new json_sum_repr = Array | Object type and field on json_sum; get_json_sum reads <json repr="object"> - atdml Codegen.ml: new sum_object_tagged_pat mode field for the pattern strings; gen_reader and gen_yojson_of switch on json_sum_repr - atdgen/src/oj_emit.ml: fill new json_sum_repr field (Array) in one hand-constructed json_sum literal - Support matrix: new "Sum as JSON object" feature row (atdml=Yes, all others=Planned) Closes #479 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2e48d9