{"id":15012966,"url":"https://github.com/ahrefs/jsonschema2atd","last_synced_at":"2025-08-18T12:14:39.290Z","repository":{"id":213733420,"uuid":"734009261","full_name":"ahrefs/jsonschema2atd","owner":"ahrefs","description":"Generate ATD types from a JSON schema / OpenAPI document","archived":false,"fork":false,"pushed_at":"2025-02-19T15:31:45.000Z","size":146,"stargazers_count":20,"open_issues_count":2,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-18T02:53:05.093Z","etag":null,"topics":["atd","jsonschema","ocaml","openapi"],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahrefs.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-20T16:36:19.000Z","updated_at":"2025-05-20T23:13:51.000Z","dependencies_parsed_at":"2024-01-09T10:54:05.004Z","dependency_job_id":"5058cfea-8f3e-4aba-88d6-900a257cf5b2","html_url":"https://github.com/ahrefs/jsonschema2atd","commit_stats":{"total_commits":52,"total_committers":4,"mean_commits":13.0,"dds":"0.23076923076923073","last_synced_commit":"f8b7e9df07144e7314f786b8c39bc9e516c862c4"},"previous_names":["ahrefs/jsonschema2atd"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ahrefs/jsonschema2atd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahrefs%2Fjsonschema2atd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahrefs%2Fjsonschema2atd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahrefs%2Fjsonschema2atd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahrefs%2Fjsonschema2atd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahrefs","download_url":"https://codeload.github.com/ahrefs/jsonschema2atd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahrefs%2Fjsonschema2atd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270989460,"owners_count":24680750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atd","jsonschema","ocaml","openapi"],"created_at":"2024-09-24T19:43:32.087Z","updated_at":"2025-08-18T12:14:39.264Z","avatar_url":"https://github.com/ahrefs.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonschema2atd\n\nGenerate an [ATD](https://github.com/ahrefs/atd) file from a JSON Schema / OpenAPI document.\n\n## Installation\n\nThe package is available on [opam](https://ocaml.org/p/jsonschema2atd/latest).\n\n```\nopam install jsonschema2atd\n```\n\nIf you wish to install the development version you can do so with:\n\n```bash\nmake install\n```\n\n## Usage\n\nGenerate an ATD file from a JSON Schema:\n```bash\njsonschema2atd ../path-to-jsonschema.json\n```\n\nGenerate an ATD file from an OpenAPI document:\n```bash\njsonschema2atd --format openapi ../path-to-openapi.json\n```\n\nYou can call `jsonschema2atd` and `atdgen` in your `dune` file to generate OCaml types and JSON serializers/deserializers from your JSON Schema or OpenAPI document:\n```\n; Add jsonschema2atd.runtime to have access to the oneOf serialization adapter (for variant unboxing).\n(library\n ...\n (libraries ... jsonschema2atd.runtime))\n\n; Generate dashboard_gen.atd from the dashboard_types_gen.json OpenAPI document with jsonschema2atd.\n(rule\n (target dashboard_gen.atd)\n ; Store the generated .atd file in the code. \n (mode promote)\n (deps ../grok/dashboard_types_gen.json)\n (action\n  (with-stdout-to\n   %{target}\n   (run\n    %{bin:jsonschema2atd} -f openapi\n    %{deps}))))\n\n; Generate dashboard_gen_t.mli, dashboard_gen_t.ml, dashboard_gen_j.mli, and dashboard_gen_j.ml from dashboard_gen.atd with atdgen.\n(rule\n (targets\n  dashboard_gen_t.mli\n  dashboard_gen_t.ml\n  dashboard_gen_j.mli\n  dashboard_gen_j.ml)\n (deps dashboard_gen.atd)\n (action\n  (progn\n   (run %{bin:atdgen} -j -j-std -j-defaults %{deps})\n   (run %{bin:atdgen} -t %{deps}))))\n```\n\nOther options can be used to control the output:\n\n- `--json-ocaml-type KEYWORD:MODULE.PATH:TYPE-NAME` to control the defitiion of\n  the `json` type used as default/fallback.\n- `--only-matching REGEXP` to limit the JSONSchema types to convert, when used\n  together with `--avoid-dangling-refs`, missing types are replaced with `json`.\n\nSee also `jsonschema2atd --help`.\n\n## ToDo\n\n- [X] Base types\n- [X] Records\n- [X] Nullable\n- [X] String enums\n- [ ] Integer enums\n- [ ] Other primitive enums\n- [X] Refs (OpenAPI format)\n- [X] OneOf (Only serialization is supported)\n- [ ] not\n- [ ] anyOf\n- [X] allOf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahrefs%2Fjsonschema2atd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahrefs%2Fjsonschema2atd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahrefs%2Fjsonschema2atd/lists"}