{"id":16542807,"url":"https://github.com/expobrain/json-schema-codegen","last_synced_at":"2026-03-09T14:06:29.302Z","repository":{"id":34243951,"uuid":"137416551","full_name":"expobrain/json-schema-codegen","owner":"expobrain","description":"Generate code from JSON schema files","archived":false,"fork":false,"pushed_at":"2026-01-19T02:18:22.000Z","size":2163,"stargazers_count":40,"open_issues_count":14,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-19T11:53:22.860Z","etag":null,"topics":["flow","javascript","json-schema-generator","python"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/expobrain.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-06-14T22:45:08.000Z","updated_at":"2025-02-02T22:26:15.000Z","dependencies_parsed_at":"2023-10-24T01:49:03.733Z","dependency_job_id":"2c0c909a-7725-40e5-979e-6b8ad2299a65","html_url":"https://github.com/expobrain/json-schema-codegen","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/expobrain/json-schema-codegen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expobrain%2Fjson-schema-codegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expobrain%2Fjson-schema-codegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expobrain%2Fjson-schema-codegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expobrain%2Fjson-schema-codegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/expobrain","download_url":"https://codeload.github.com/expobrain/json-schema-codegen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expobrain%2Fjson-schema-codegen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30297920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T13:46:43.843Z","status":"ssl_error","status_checked_at":"2026-03-09T13:46:42.821Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["flow","javascript","json-schema-generator","python"],"created_at":"2024-10-11T18:58:35.376Z","updated_at":"2026-03-09T14:06:29.274Z","avatar_url":"https://github.com/expobrain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/expobrain/json-schema-codegen.svg?branch=master)](https://travis-ci.org/expobrain/json-schema-codegen)\n\n# json-schema-codegen\n\nGenerate code from JSON schema files.\n\n# Table of contents\n\n- [Introduction](#introduction)\n- [Currently supported languages](#currently-supported-languages)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Code generation](#code-generation)\n  - [Python3](#python-3)\n  - [Python3+Marshmallow](#python-3marshmallow)\n  - [JavaScript+Flow and Flow](#javascriptflow-and-flow)\n- [Contribute](#contribute)\n\n# Introduction\n\nThis is a command line tool to take a [json-schema](http://json-schema.org/) file and generate code automatically.\n\nFor instance this `json-schema` definition:\n\n```json\n{\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n  \"title\": \"Test\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"id\": { \"type\": \"integer\" }\n  }\n}\n```\n\nwill generate this Python code:\n\n```python\nclass Test(object):\n    def __init__(self, data=None):\n        data = data or {}\n\n        self.id = data.get(\"id\")\n```\n\nor this JavaScript+Flow code:\n\n```javascript\nexport class Test {\n  id: ?number;\n\n  constructor(data: Object = {}) {\n    this.id = data.id;\n  }\n}\n```\n\nCurrently this tool generates code for Python and JavaScript with [Flow](https://flow.org/) annotations but it can be extended to generate code for any language.\n\nThe code generation is divided in two stages:\n\n1.  generate the [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) for the target language from the `json-schema` file\n1.  convert the AST into the target language\n\nThis allows the tool to be language agnostic, that is it just needs to generate the AST in JSON format for the target language and then a language specific tool will convert this AST into proper code.\n\n# Currently supported languages\n\nList of currently supported languages:\n\n- Python 3.7+\n- JavaScript ES7+ with Flow annotations\n- pure Flow annotations\n\n# Requirements\n\n- Python 3.6 / 3.7\n- Node v12\n\n# Installation\n\nUntil this [pull request](https://github.com/pypa/setuptools/pull/1389) in [`setuptools`](https://pypi.org/project/setuptools/) is fixed, the only way to install `json-schema-codegen` is to clone the repo:\n\n```shell\ngit clone https://github.com/expobrain/json-schema-codegen.git\n```\n\n# Usage\n\n```shell\nusage: json_codegen.py [-h] [--prefix PREFIX] [--language LANGUAGE]\n                       [--output OUTPUT]\n                       schema\n\npositional arguments:\n  schema                Definition of the PRD as JSON schema\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --prefix PREFIX, -p PREFIX\n                        Optional prefix for generated classes\n  --language LANGUAGE, -l LANGUAGE\n                        Output language. Default is python\n  --output OUTPUT, -o OUTPUT\n                        Output filename for the generated code\n```\n\n# Code generation\n\n## Python 3\n\nThe egenerator of pure Python 3 compatible code:\n\n```shell\njson_codegen --language python3 --output \u003coutput_py_file\u003e \u003cjson-schema\u003e\n```\n\n## Python 3+Marshmallow\n\nThe generation of Python 3's code with [Marshmallow](https://marshmallow.readthedocs.io/en/2.x-line/) support is integrated into the tool so it needs just a single invocation:\n\n```shell\njson_codegen --language python3+marshmallow --output \u003coutput_py_file\u003e \u003cjson-schema\u003e\n```\n\n## JavaScript+Flow and Flow\n\nGenerating JavaScript+Flow and Flow code involves two steps, generating the AST:\n\n```shell\njson_codegen --language [javascript+flow|flow] --output \u003coutput_ast_json\u003e \u003cjson-schema\u003e\n```\n\nand generating the code from the AST:\n\n```shell\nbin/ast_to_js \u003coutput_ast_json\u003e \u003coutput_js_file\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpobrain%2Fjson-schema-codegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpobrain%2Fjson-schema-codegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpobrain%2Fjson-schema-codegen/lists"}