gitwtfhub

wtf is atd?

semgrep/atd — explained in plain English

Analysis updated 2026-07-27 · repo last pushed 2023-07-10

OCamlAudience · developerComplexity · 2/5DormantLicenseSetup · moderate

TL;DR

ATD lets you write one data-type definition and automatically generate ready-to-use JSON parsing code for Java, Python, Scala, and OCaml, so every platform stays in sync without hand-coding.

Mindmap

mindmap
  root((repo))
    What it does
      Write type definitions once
      Generate code per language
      Automatic JSON validation
    Languages supported
      Java
      Python
      Scala
      OCaml
    Use cases
      Multi-platform API clients
      Keep teams in sync
      Shared data definitions
    Audience
      API developers
      Backend teams
      Cross-platform teams
    License
      BSD license
      Commercial use OK

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Generate JSON parsing code for a mobile app with Android, backend, and data analysis teams sharing one spec.

REASON 2

Keep API data models in sync across Java, Python, Scala, and OCaml by regenerating from a single definition file.

REASON 3

Catch malformed JSON automatically with generated validators instead of debugging at runtime.

REASON 4

Maintain one source of truth for data structures across multiple client platforms.

What's in the stack?

OCamlJavaPythonScala

How it stacks up

semgrep/atdbracevac/efftonistiigi/datakit
LanguageOCamlOCamlOCaml
Last pushed2023-07-102016-12-022018-10-01
MaintenanceDormantDormantDormant
Setup difficultymoderatemoderatehard
Complexity2/54/54/5
Audiencedeveloperresearcherops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires installing OCaml and the relevant ATD generator (atdj, atdpy, atds, or atdgen) for each target language.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

Wtf does this do

ATD (Adaptable Type Definitions) solves a common headache when building software that communicates via JSON APIs: keeping data definitions consistent across different programming languages. Instead of manually writing and maintaining separate data models in Java, Python, Scala, and OCaml, you write a single type definition once and let ATD generate the appropriate code for each language. You write a specification describing your data structures, what fields they have, what types those fields are, and which are optional. Then you run one of ATD's code generators (atdj for Java, atdpy for Python, atds for Scala, atdgen for OCaml) and get back ready-to-use code that can convert JSON data into native objects in that language. It also generates validators, so if the incoming JSON is missing a required field or has the wrong type, you catch it automatically rather than discovering the problem at runtime in production. This tool fits teams building APIs consumed by multiple client platforms. Say you're shipping a mobile app with an Android frontend in Java, a backend in Scala, and some data analysis in Python. Rather than having each team hand-code their own JSON parsing logic and inevitably drift apart as the API evolves, you maintain one shared definition file as the source of truth. Change the spec, regenerate the code in each language, and every platform stays in sync. The project started in 2010 and has attracted a long list of contributors over the years. The README doesn't go into detail about specific performance characteristics or design tradeoffs, pointing readers to external documentation for that. The tools are distributed under a BSD license, making them suitable for both open-source and commercial use.

Yoink these prompts

Prompt 1
I have an API consumed by Java, Python, and Scala clients. How do I use ATD to write one type definition file and generate JSON parsing code for all three languages?
Prompt 2
Show me how to define an ATD type with required and optional fields, then generate Python code using atdpy that parses JSON into native objects.
Prompt 3
How do I set up ATD so that every time I change my data spec, I can regenerate code for Java, Scala, and OCaml and keep all platforms in sync?
Prompt 4
Write an ATD definition for a user profile object with name, email, optional phone, and a list of roles, then generate Java code with atdj.

Frequently asked questions

wtf is atd?

ATD lets you write one data-type definition and automatically generate ready-to-use JSON parsing code for Java, Python, Scala, and OCaml, so every platform stays in sync without hand-coding.

What language is atd written in?

Mainly OCaml. The stack also includes OCaml, Java, Python.

Is atd actively maintained?

Dormant — no commits in 2+ years (last push 2023-07-10).

What license does atd use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is atd to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is atd for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.