{"id":20330046,"url":"https://github.com/json-schema-tools/referencer","last_synced_at":"2025-04-11T21:02:49.564Z","repository":{"id":37788319,"uuid":"291222518","full_name":"json-schema-tools/referencer","owner":"json-schema-tools","description":"Flatten a JSON Schema by turning its subschemas into refs.  The result is a schema which is 'maximally reffed'. The opposite of dereferencing.","archived":false,"fork":false,"pushed_at":"2024-08-23T22:33:48.000Z","size":988,"stargazers_count":1,"open_issues_count":9,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T16:55:49.460Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://json-schema-tools.github.io/referencer/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/json-schema-tools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"belfordz","open_collective":"zachary-belford"}},"created_at":"2020-08-29T07:22:21.000Z","updated_at":"2024-05-27T15:49:06.000Z","dependencies_parsed_at":"2024-05-03T23:30:06.366Z","dependency_job_id":"ff8d9f15-c808-4af1-8920-a579fbd80847","html_url":"https://github.com/json-schema-tools/referencer","commit_stats":{"total_commits":69,"total_committers":4,"mean_commits":17.25,"dds":0.5942028985507246,"last_synced_commit":"b9dcabb1fc8db06ff19d8f138fa345f849769e6b"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-schema-tools%2Freferencer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-schema-tools%2Freferencer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-schema-tools%2Freferencer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-schema-tools%2Freferencer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/json-schema-tools","download_url":"https://codeload.github.com/json-schema-tools/referencer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125636,"owners_count":21051766,"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":[],"created_at":"2024-11-14T20:14:44.712Z","updated_at":"2025-04-11T21:02:49.049Z","avatar_url":"https://github.com/json-schema-tools.png","language":"TypeScript","funding_links":["https://github.com/sponsors/belfordz","https://opencollective.com/zachary-belford"],"categories":[],"sub_categories":[],"readme":"# JSON Schema Referencer\n\n\u003ccenter\u003e\n  \u003cspan\u003e\n    \u003cimg alt=\"CircleCI branch\" src=\"https://img.shields.io/circleci/project/github/json-schema-tools/referencer/master.svg\"\u003e\n    \u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dt/@json-schema-tools/referencer.svg\" /\u003e\n    \u003cimg alt=\"GitHub release\" src=\"https://img.shields.io/github/release/json-schema-tools/referencer.svg\" /\u003e\n    \u003cimg alt=\"GitHub commits since latest release\" src=\"https://img.shields.io/github/commits-since/json-schema-tools/referencer/latest.svg\" /\u003e\n  \u003c/span\u003e\n\u003c/center\u003e\n\nReferencer is a package that exports a single function - a function that accepts and returns a JSON Schema. The returned schema is 'flat', as in, any subschemas of the schema have been converted into $refs. Further, any of the subschemas' subschema are also $reffed, recurively until everything is a $ref, and the definition section is fully populated.\n\nThe input schema may have refs, but the refs must already be in the definitions section.\nThe input schema, as well as all of its subschemas must have titles. Their titles must also be unique for their content. We would like to use $id, but it has special meaning and therefor title is used as the unique identifier on-which schemas will be referenced.\n\nFeatures:\n - Cyclic schemas become cyclic references\n - Completely synchronous\n - immutable by default, option to mutate in place.\n - No external dependencies\n - Fully typed against the generated [meta-schema typings](https://github.com/json-schema-tools/meta-schema/)\n - magically makes your json schema smaller.\n\n## Usage\n\ninstall it:\n`npm install @json-schema-tools/referencer`\n\nuse it:\n```typescript\nimport referencer from \"@json-schema-tools/referencer\";\n\nconst result = referencer({\n  title: \"example\",\n  type: \"object\",\n  properties: {\n    foo: { title: \"foo\", type: \"number\" },\n    bar: { title: \"bar\", type: \"string\" }\n  }\n});\n\nconsole.log(result);\n\n// outputs\n{\n  title: \"example\",\n  type: \"object\",\n  properties: {\n    foo: {$ref: \"#/definitions/foo\" },\n    bar: { $ref: \"#/definitions/bar\" }\n  },\n  definitions: {\n    foo: { title: \"foo\", type: \"number\" }\n    bar: { title: \"bar\", type: \"string\" }\n  }\n}\n```\n\n## License\n\nApache-2.0\n\n\n### Contributing\n\nHow to contribute, build and release are outlined in [CONTRIBUTING.md](CONTRIBUTING.md), [BUILDING.md](BUILDING.md) and [RELEASING.md](RELEASING.md) respectively. Commits in this repository follow the [CONVENTIONAL_COMMITS.md](CONVENTIONAL_COMMITS.md) specification.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjson-schema-tools%2Freferencer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjson-schema-tools%2Freferencer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjson-schema-tools%2Freferencer/lists"}