json-schema-ref-resolver
Advanced tools
Comparing version
@@ -233,3 +233,3 @@ 'use strict' | ||
throw new Error( | ||
`Cannot resolve ref "${ref.ref}". Property "${key}" is already exist in schema "${ref.sourceSchemaId}".` | ||
`Cannot resolve ref "${ref.ref}". Property "${key}" already exists in schema "${ref.sourceSchemaId}".` | ||
) | ||
@@ -254,3 +254,3 @@ } | ||
if (anchors[anchor] !== undefined) { | ||
throw new Error(`There is already another anchor "${anchor}" in a schema "${schemaId}".`) | ||
throw new Error(`There is already another anchor "${anchor}" in schema "${schemaId}".`) | ||
} | ||
@@ -257,0 +257,0 @@ anchors[anchor] = schema |
{ | ||
"name": "json-schema-ref-resolver", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "JSON schema reference resolver", | ||
@@ -9,4 +9,4 @@ "main": "index.js", | ||
"scripts": { | ||
"lint": "standard", | ||
"lint:fix": "standard --fix", | ||
"lint": "eslint", | ||
"lint:fix": "eslint --fix", | ||
"test:unit": "c8 --100 node --test", | ||
@@ -24,2 +24,5 @@ "test:typescript": "tsd", | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/fastify/json-schema-ref-resolver/issues" | ||
}, | ||
"keywords": [ | ||
@@ -33,4 +36,34 @@ "json", | ||
"author": "Ivan Tymoshenko <ivan@tymoshenko.me>", | ||
"contributors": [ | ||
{ | ||
"name": "Matteo Collina", | ||
"email": "hello@matteocollina.com" | ||
}, | ||
{ | ||
"name": "James Sumners", | ||
"url": "https://james.sumners.info" | ||
}, | ||
{ | ||
"name": "Gürgün Dayıoğlu", | ||
"email": "hey@gurgun.day", | ||
"url": "https://heyhey.to/G" | ||
}, | ||
{ | ||
"name": "Frazer Smith", | ||
"email": "frazer.dev@icloud.com", | ||
"url": "https://github.com/fdawgs" | ||
} | ||
], | ||
"license": "MIT", | ||
"homepage": "https://github.com/fastify/json-schema-ref-resolver#readme", | ||
"funding": [ | ||
{ | ||
"type": "github", | ||
"url": "https://github.com/sponsors/fastify" | ||
}, | ||
{ | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/fastify" | ||
} | ||
], | ||
"dependencies": { | ||
@@ -41,11 +74,7 @@ "dequal": "^2.0.3" | ||
"@fastify/pre-commit": "^2.1.0", | ||
"c8": "^9.1.0", | ||
"standard": "^17.1.0", | ||
"c8": "^10.1.3", | ||
"eslint": "^9.17.0", | ||
"neostandard": "^0.12.0", | ||
"tsd": "^0.31.0" | ||
}, | ||
"standard": { | ||
"ignore": [ | ||
"types/*" | ||
] | ||
} | ||
} |
# json-schema-ref-resolver | ||
[](https://github.com/fastify/json-schema-ref-resolver/actions/workflows/ci.yml) | ||
[](https://www.npmjs.com/package/json-schema-ref-resolver) | ||
[](https://github.com/neostandard/neostandard) | ||
__json-schema-ref-resolver__ is a javascript library that resolves references in [JSON schemas](https://json-schema.org/draft/2020-12/json-schema-core#name-introduction). | ||
@@ -258,3 +262,3 @@ | ||
Dereferences all references in the schema. All dependency also will be dereferenced. If schema with the specified id is not found, an error will be thrown. | ||
Dereferences all references in the schema. All dependencies will also be dereferenced. If schema with the specified id is not found, an error will be thrown. | ||
@@ -365,3 +369,3 @@ - `schemaId` __\<string\>__ - schema id of the schema to dereference. | ||
- If a reference schema and a source schema have a key with the same name and different values, an error will be throwing during a call to `derefSchema` or `getDerefSchema`. | ||
- If a reference schema and a source schema have a key with the same name and different values, an error will be thrown during a call to `derefSchema` or `getDerefSchema`. | ||
@@ -401,1 +405,5 @@ _Example:_ | ||
``` | ||
## License | ||
Licensed under [MIT](./LICENSE). |
@@ -197,4 +197,4 @@ 'use strict' | ||
} catch (err) { | ||
assert.equal(err.message, 'There is already another anchor "#subSchemaId" in a schema "schemaId1".') | ||
assert.equal(err.message, 'There is already another anchor "#subSchemaId" in schema "schemaId1".') | ||
} | ||
}) |
@@ -48,3 +48,3 @@ 'use strict' | ||
err.message, | ||
'Cannot resolve ref "schemaId2". Property "properties" is already exist in schema "schemaId1".' | ||
'Cannot resolve ref "schemaId2". Property "properties" already exists in schema "schemaId1".' | ||
) | ||
@@ -51,0 +51,0 @@ } |
@@ -7,3 +7,2 @@ /** | ||
declare class RefResolver { | ||
/** | ||
@@ -13,3 +12,3 @@ * @param {object} opts - Options for the resolver. | ||
*/ | ||
constructor(opts?: { allowEqualDuplicates?: boolean }); | ||
constructor (opts?: { allowEqualDuplicates?: boolean }) | ||
@@ -21,3 +20,3 @@ /** | ||
*/ | ||
addSchema(schema: any, schemaId?: string): void; | ||
addSchema (schema: any, schemaId?: string): void | ||
@@ -31,3 +30,3 @@ /** | ||
*/ | ||
getSchema(schemaId: string, jsonPointer?: string): any | null; | ||
getSchema (schemaId: string, jsonPointer?: string): any | null | ||
@@ -39,3 +38,3 @@ /** | ||
*/ | ||
hasSchema(schemaId: string): boolean; | ||
hasSchema (schemaId: string): boolean | ||
@@ -47,3 +46,3 @@ /** | ||
*/ | ||
getSchemaRefs(schemaId: string): { schemaId: string; jsonPointer: string }[]; | ||
getSchemaRefs (schemaId: string): { schemaId: string; jsonPointer: string }[] | ||
@@ -55,3 +54,3 @@ /** | ||
*/ | ||
getSchemaDependencies(schemaId: string): { [key: string]: any }; | ||
getSchemaDependencies (schemaId: string): { [key: string]: any } | ||
@@ -62,3 +61,3 @@ /** | ||
*/ | ||
derefSchema(schemaId: string): void; | ||
derefSchema (schemaId: string): void | ||
@@ -73,5 +72,5 @@ /** | ||
*/ | ||
getDerefSchema(schemaId: string, jsonPointer?: string): any | null; | ||
getDerefSchema (schemaId: string, jsonPointer?: string): any | null | ||
} | ||
export { RefResolver }; | ||
export { RefResolver } |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
58818
2.81%18
12.5%1497
0.34%0
-100%407
2.01%5
25%