json-schema-resolver
Advanced tools
Comparing version 2.0.0 to 3.0.0
{ | ||
"name": "json-schema-resolver", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Resolve all your $refs", | ||
"main": "ref-resolver.js", | ||
"scripts": { | ||
"lint": "standard", | ||
"lint:fix": "standard --fix", | ||
"test": "tap test/**/*.test.js" | ||
"lint": "eslint", | ||
"lint:fix": "eslint --fix", | ||
"test": "c8 node --test" | ||
}, | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=20" | ||
}, | ||
@@ -26,9 +26,10 @@ "repository": { | ||
"devDependencies": { | ||
"standard": "^17.0.0", | ||
"tap": "^16.3.0" | ||
"c8": "^10.1.3", | ||
"eslint": "^9.18.0", | ||
"neostandard": "^0.12.0" | ||
}, | ||
"dependencies": { | ||
"debug": "^4.1.1", | ||
"rfdc": "^1.1.4", | ||
"uri-js": "^4.2.2" | ||
"fast-uri": "^3.0.5", | ||
"rfdc": "^1.1.4" | ||
}, | ||
@@ -35,0 +36,0 @@ "keywords": [ |
# json-schema-resolver | ||
[![CI](https://github.com/Eomm/json-schema-resolver/workflows/ci/badge.svg)](https://github.com/Eomm/json-schema-resolver/actions?query=workflow%3Aci) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) | ||
[![CI](https://github.com/Eomm/json-schema-resolver/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/Eomm/json-schema-resolver/actions/workflows/ci.yml) | ||
[![NPM version](https://img.shields.io/npm/v/json-schema-resolver.svg?style=flat)](https://www.npmjs.com/package/json-schema-resolver) | ||
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard) | ||
@@ -35,3 +36,3 @@ Resolve all `$refs` in your [JSON schema](https://json-schema.org/specification.html)! | ||
// the `json` that is being resolved | ||
// the `baseUri` object of the schema. Its values is the parse result from https://www.npmjs.com/package/uri-js | ||
// the `baseUri` object of the schema. Its values is the parse result from https://www.npmjs.com/package/fast-uri | ||
// the `fragment` is the `$ref` string when the `$ref` is a relative reference | ||
@@ -38,0 +39,0 @@ // the `i` is a local counter to generate a unique key |
'use strict' | ||
const URI = require('uri-js') | ||
const URI = require('fast-uri') | ||
const cloner = require('rfdc')({ proto: true, circles: false }) | ||
@@ -106,3 +106,3 @@ const { EventEmitter } = require('events') | ||
} | ||
rootSchema[kIgnore] = true | ||
Object.defineProperty(rootSchema, kIgnore, { value: true, enumerable: false }) | ||
@@ -122,3 +122,3 @@ mapIds(ee, appUri, rootSchema) | ||
} | ||
evaluatedJson[kConsumed] = true | ||
Object.defineProperty(evaluatedJson, kConsumed, { value: true, enumerable: false }) | ||
json.$ref = `#/definitions/${evaluatedJson[kRefToDef]}${refUri.fragment || ''}` | ||
@@ -151,3 +151,4 @@ }) | ||
debug('Collected $id %s', id) | ||
json[kRefToDef] = buildLocalReference(json, baseUri, fragment, rolling++) | ||
const value = buildLocalReference(json, baseUri, fragment, rolling++) | ||
Object.defineProperty(json, kRefToDef, { value, enumerable: false }) | ||
allIds.set(id, json) | ||
@@ -154,0 +155,0 @@ } else { |
13316
5
206
147
3
+ Addedfast-uri@^3.0.5
+ Addedfast-uri@3.0.6(transitive)
- Removeduri-js@^4.2.2
- Removedpunycode@2.3.1(transitive)
- Removeduri-js@4.4.1(transitive)