{"id":20330055,"url":"https://github.com/json-schema-tools/dereferencer","last_synced_at":"2025-04-11T21:02:47.309Z","repository":{"id":37789751,"uuid":"274509402","full_name":"json-schema-tools/dereferencer","owner":"json-schema-tools","description":"JSON Schema Dereferencer (aka refParser) written in typescript","archived":false,"fork":false,"pushed_at":"2025-01-20T21:58:13.000Z","size":1557,"stargazers_count":9,"open_issues_count":13,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T16:55:50.320Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://json-schema-tools.github.io/dereferencer/","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-06-23T21:09:21.000Z","updated_at":"2024-10-23T18:02:29.000Z","dependencies_parsed_at":"2024-04-22T22:37:53.254Z","dependency_job_id":"83443a50-94b6-4dd7-92e7-fc1cb53e6dc7","html_url":"https://github.com/json-schema-tools/dereferencer","commit_stats":{"total_commits":202,"total_committers":7,"mean_commits":"28.857142857142858","dds":0.6089108910891089,"last_synced_commit":"89751996e8c06ff332ae5eec7492bd151c20aa7a"},"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-schema-tools%2Fdereferencer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-schema-tools%2Fdereferencer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-schema-tools%2Fdereferencer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/json-schema-tools%2Fdereferencer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/json-schema-tools","download_url":"https://codeload.github.com/json-schema-tools/dereferencer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974731,"owners_count":21026742,"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:46.765Z","updated_at":"2025-04-11T21:02:46.935Z","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 Dereferencer\n\n\u003ccenter\u003e\n  \u003cspan\u003e\n    \u003cimg alt=\"CircleCI branch\" src=\"https://img.shields.io/circleci/project/github/json-schema-tools/dereferencer/master.svg\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/json-schema-tools/dereferencer/branch/master/graph/badge.svg\" /\u003e\n    \u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dt/@json-schema-tools/dereferencer.svg\" /\u003e\n    \u003cimg alt=\"GitHub release\" src=\"https://img.shields.io/github/release/json-schema-tools/dereferencer.svg\" /\u003e\n    \u003cimg alt=\"GitHub commits since latest release\" src=\"https://img.shields.io/github/commits-since/json-schema-tools/dereferencer/latest.svg\" /\u003e\n  \u003c/span\u003e\n\u003c/center\u003e\n\nOtherwise known as a ref parser, this tool will replace json schema using $ref with the underlying reference, returning relevant errors otherwise.\n\nBuilt using @json-schema-tools/traverse\n\n## features\n\n- minimal dependencies\n- simple \u0026 fast\n- cycle detection/handling\n- switchable recusive dereferencing\n- works in node \u0026 in browser (isomorphic)\n- handles:\n  - relative pointer refs\n  - http/https uris\n  - local filesystem references\n- configurable\n - optionally de-reference internal references only, keeping it synchronous\n - ignore refs that match a set of patterns\n- extensible\n  - dependency injectable fetch and filesystem\n  - middleware allows you to easily implement new $ref values.\n  - easily add behaviors for custom reference locations\n- option for mutating in place or returning a copy\n\n## Getting Started\n\n`npm install @json-schema-tools/dereferencer`\n\n```typescript\nconst JsonSchemaDereferencer = require(\"@json-schema-tools/dereferencer\").default;\n\nconst mySchema = {\n    type: \"object\",\n    properties: {\n      foo: { anyOf: [\n        { $ref: \"#/properties/bar\" },\n        { type: \"string\" }\n      ]},\n      bar: { $ref: \"#/properties/foo\" },\n      baz: { $ref: \"../myschemas/baz.json\" },\n      jsonSchemaMetaSchema: { $ref: \"https://meta.json-schema.tools\" }\n    },\n    additionalProperties: {\n        type: \"array\",\n        items: [\n            { type: \"array\", items: { $ref: \"#\" } },\n            { type: \"boolean\" }\n        ]\n    }\n};\n\nconst dereferencer = new JsonSchemaDereferencer(mySchema);\n\nconsole.log(dereferencer.resolveSync());\nconsole.log(await dereferencer.resolve());\n```\n\n\n### Add custom protocol handling\n\n```typescript\nimport JsonSchemaDereferencer from \"@json-schema-tools/dereferencer\";\n\nconst mySchema = {\n    type: \"object\",\n    properties: {\n      foo: { $ref: \"ipfs://39420398420384\" }\n    }\n};\n\nconst dereferencer = new JsonSchemaDereferencer(mySchema, {\n  protocolHandlerMap: {\n    \"ipfs\": (ref) =\u003e Promise.resolve({ type: \"string\", title: \"pretend we got this from ipfs\" })\n});\n\nconsole.log(dereferencer.resolveSync());\nconsole.log(await dereferencer.resolve());\n```\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%2Fdereferencer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjson-schema-tools%2Fdereferencer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjson-schema-tools%2Fdereferencer/lists"}