{"id":27054266,"url":"https://github.com/atombender/go-jsonschema","last_synced_at":"2025-04-05T09:04:41.212Z","repository":{"id":38848921,"uuid":"150624828","full_name":"omissis/go-jsonschema","owner":"omissis","description":"A tool to generate Go data types from JSON Schema definitions.","archived":false,"fork":false,"pushed_at":"2025-03-25T21:55:39.000Z","size":751,"stargazers_count":650,"open_issues_count":56,"forks_count":101,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-30T23:08:26.302Z","etag":null,"topics":["code-generation","codegenerator","go","golang","json","json-schema"],"latest_commit_sha":null,"homepage":"","language":"Go","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/omissis.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-09-27T17:36:32.000Z","updated_at":"2025-03-27T05:44:47.000Z","dependencies_parsed_at":"2023-11-11T02:25:47.606Z","dependency_job_id":"a8392122-4240-4866-bdef-c0075d01fc48","html_url":"https://github.com/omissis/go-jsonschema","commit_stats":{"total_commits":368,"total_committers":41,"mean_commits":8.975609756097562,"dds":0.6222826086956521,"last_synced_commit":"a74cd4e2851ceec9ac0a8c6f9d9e66694c03612f"},"previous_names":["atombender/go-jsonschema"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omissis%2Fgo-jsonschema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omissis%2Fgo-jsonschema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omissis%2Fgo-jsonschema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omissis%2Fgo-jsonschema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omissis","download_url":"https://codeload.github.com/omissis/go-jsonschema/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312077,"owners_count":20918344,"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","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":["code-generation","codegenerator","go","golang","json","json-schema"],"created_at":"2025-04-05T09:02:49.616Z","updated_at":"2025-04-05T09:04:41.177Z","avatar_url":"https://github.com/omissis.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"**go-jsonschema is a tool to generate Go data types from [JSON Schema](http://json-schema.org/) definitions.**\n\nThis tool generates Go data types and structs that corresponds to definitions in the schema,\nalong with unmarshalling code that validates the input JSON according to the schema's validation rules.\n\n## Badges\n\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/omissis/go-jsonschema?style=flat)](https://github.com/omissis/go-jsonschema/releases/latest)\n[![GitHub Workflow Status (event)](https://img.shields.io/github/actions/workflow/status/omissis/go-jsonschema/development.yaml?style=flat)](https://github.com/omissis/go-jsonschema/actions?workflow=development)\n[![License](https://img.shields.io/github/license/omissis/go-jsonschema?style=flat)](/LICENSE.md)\n[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/omissis/go-jsonschema?style=flat)](https://tip.golang.org/doc/go1.23)\n[![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/omissis/go-jsonschema?style=flat)](https://github.com/omissis/go-jsonschema)\n[![GitHub repo file count (file type)](https://img.shields.io/github/directory-file-count/omissis/go-jsonschema?style=flat)](https://github.com/omissis/go-jsonschema)\n[![GitHub all releases](https://img.shields.io/github/downloads/omissis/go-jsonschema/total?style=flat)](https://github.com/omissis/go-jsonschema)\n[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/omissis/go-jsonschema?style=flat)](https://github.com/omissis/go-jsonschema/commits)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat)](https://conventionalcommits.org)\n[![Codecov](https://img.shields.io/codecov/c/gh/omissis/go-jsonschema?style=flat\u0026token=lPWlXd3MVK)](https://codecov.io/gh/omissis/go-jsonschema)\n[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/omissis/go-jsonschema?style=flat)](https://codeclimate.com/github/omissis/go-jsonschema)\n[![Go Report Card](https://goreportcard.com/badge/github.com/omissis/go-jsonschema)](https://goreportcard.com/report/github.com/omissis/go-jsonschema)\n\n## Installing\n\n* **Download**: Get a release [here](https://github.com/atombender/go-jsonschema/releases).\n\n* **Install from source**: To install with Go 1.23+:\n\n```shell\ngo get github.com/atombender/go-jsonschema/...\ngo install github.com/atombender/go-jsonschema@latest\n```\n\n* **Install with Brew**: To install with [Homebrew](https://brew.sh):\n\n```shell\nbrew tap omissis/go-jsonschema\nbrew install go-jsonschema\n```\n\n## Contributing\n\nThis project makes use of [go workspaces](https://go.dev/ref/mod#workspaces) in order to ease testing of the\ngenerated code during development while keeping the codebase as tidy and maintainable as possible.\nIt's an unusual choice, but it allows to not only test the code-generation logic, but also the generated code itself.\n\n## Usage\n\nAt its most basic:\n\n```shell\ngo-jsonschema -p main schema.json\n```\n\nThis will write a Go source file to standard output, declared under the package `main`.\n\nYou can generate code for multiple schemas in one run, optionally writing to different files inside different packages:\n\n```shell\n$ go-jsonschema \\\n  --schema-package=https://example.com/schema1=github.com/myuser/myproject \\\n   --schema-output=https://example.com/schema1=schema1.go \\\n  --schema-package=https://example.com/schema2=github.com/myuser/myproject/stuff \\\n   --schema-output=https://example.com/schema2=stuff/schema2.go \\\n  schema1.json schema2.json\n```\n\nThis will create `schema1.go` (declared as `package myproject`) and `stuff/schema2.go` (declared as `package stuff`).\nIf `schema1.json` refers to `schema2.json` or viceversa, the two Go files will import the other depended-on package.\nNote the flag format:\n\n```text\n--schema-package=https://example.com/schema1=github.com/myuser/myproject \\\n                 ^                           ^\n                 |                           |\n                 schema $id                  full import URL\n```\n\n### Special types\n\nIn a few cases, special types are used to help with serializing/deserializing\ndata frrom JSON. Namely a custom types is provided for the following semantic\ntypes:\n\n* `SerializableDate`\n* `SerializableTime`\n\nThese types are needed because there is no native type provided by Go which\nproperly handles them.\n\n## Status\n\nWhile not finished, go-jsonschema can be used today. Aside from some minor features,\nonly specific validations remain to be fully implemented.\n\n### Validation\n\n* Core ([RFC draft](http://json-schema.org/latest/json-schema-core.html))\n  * [x] Data model (§4.2.1)\n    * [x] `null`\n    * [x] `boolean`\n    * [x] `object`\n    * [x] `array`\n    * [x] `number`\n      * [ ] Option to use `json.Number`\n    * [x] `string`\n  * [ ] Location identifiers (§8.2.3)\n    * [x] References against top-level names: `#/$defs/someName`\n    * [ ] References against nested names: `#/$defs/someName/$defs/someOtherName`\n    * [x] References against top-level names in external files: `myschema.json#/$defs/someName`\n    * [ ] References against nested names: `myschema.json#/$defs/someName/$defs/someOtherName`\n  * [x] Comments (§9)\n* Validation ([RFC draft](http://json-schema.org/latest/json-schema-validation.html))\n  * [ ] Schema annotations (§10)\n    * [x] `description`\n    * [x] `default` (only for struct fields)\n    * [ ] `readOnly`\n    * [ ] `writeOnly`\n    * [ ] ~~`title`~~ (N/A)\n    * [ ] ~~`examples`~~ (N/A)\n  * [ ] General validation (§6.1)\n    * [x] `enum`\n    * [x] `type` (single)\n    * [x] `type` (multiple; **note**: partial support, limited validation)\n    * [ ] `const`\n  * [X] Numeric validation (§6.2)\n    * [X] `multipleOf`\n    * [X] `maximum`\n    * [X] `exclusiveMaximum`\n    * [X] `minimum`\n    * [X] `exclusiveMinimum`\n  * [X] String validation (§6.3)\n    * [X] `maxLength`\n    * [X] `minLength`\n    * [X] `pattern`\n  * [ ] Array validation (§6.4)\n    * [X] `items`\n    * [x] `maxItems`\n    * [x] `minItems`\n    * [ ] `uniqueItems`\n    * [ ] `additionalItems`\n    * [ ] `contains`\n  * [ ] Object validation (§6.5)\n    * [x] `required`\n    * [x] `properties`\n    * [ ] `patternProperties`\n    * [ ] `dependencies`\n    * [ ] `propertyNames`\n    * [ ] `maxProperties`\n    * [ ] `minProperties`\n  * [ ] Conditional subschemas (§6.6)\n    * [ ] `if`\n    * [ ] `then`\n    * [ ] `else`\n  * [ ] Boolean subschemas (§6.7)\n    * [ ] `allOf`\n    * [ ] `anyOf`\n    * [ ] `oneOf`\n    * [ ] `not`\n  * [ ] Semantic formats (§7.3)\n    * [x] Dates and times\n    * [ ] Email addresses\n    * [ ] Hostnames\n    * [ ] IP addresses\n    * [ ] Resource identifiers\n    * [ ] URI-template\n    * [ ] JSON pointers\n    * [ ] Regex\n\n## License\n\nMIT license. See `LICENSE` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatombender%2Fgo-jsonschema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatombender%2Fgo-jsonschema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatombender%2Fgo-jsonschema/lists"}