@json-schema-tools/dereferencer
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -268,2 +268,3 @@ "use strict"; | ||
if (this.refs.length === 0) { | ||
delete this.schema.definitions; | ||
return [2 /*return*/, Promise.resolve(this.schema)]; | ||
@@ -270,0 +271,0 @@ } |
@@ -140,6 +140,9 @@ "use strict"; | ||
props = dereffed.properties; | ||
expect(props.jsonSchemaMetaSchema.type).toBeDefined(); | ||
expect(props.jsonSchemaMetaSchema.definitions.nonNegativeIntegerDefault0).toBeDefined(); | ||
expect(props.jsonSchemaMetaSchema.definitions.nonNegativeIntegerDefault0.allOf[0].$ref).toBeUndefined(); | ||
expect(props.jsonSchemaMetaSchema.definitions.nonNegativeIntegerDefault0.allOf[0].type).toBe("integer"); | ||
expect(props.jsonSchemaMetaSchema.type).toEqual(["object", "boolean"]); | ||
expect(props.jsonSchemaMetaSchema.properties.maxLength.title) | ||
.toBe("nonNegativeInteger"); | ||
expect(props.jsonSchemaMetaSchema.properties.minItems.title) | ||
.toBe("nonNegativeIntegerDefaultZero"); | ||
expect(props.jsonSchemaMetaSchema.properties.dependencies.additionalProperties.anyOf[0]) | ||
.toBe(props.jsonSchemaMetaSchema); | ||
return [2 /*return*/]; | ||
@@ -154,3 +157,3 @@ } | ||
case 0: | ||
expect.assertions(6); | ||
expect.assertions(8); | ||
dereferencer = new index_1.default({ | ||
@@ -168,2 +171,4 @@ $ref: "https://raw.githubusercontent.com/json-schema-tools/meta-schema/master/meta-schema.json", | ||
expect(dereffed.properties.additionalItems).toBe(dereffed); | ||
expect(dereffed.properties.minProperties.title).toBe("nonNegativeIntegerDefaultZero"); | ||
expect(dereffed.definitions).toBeUndefined(); | ||
return [2 /*return*/]; | ||
@@ -170,0 +175,0 @@ } |
@@ -0,1 +1,8 @@ | ||
## [1.0.13](https://github.com/json-schema-tools/dereferencer/compare/1.0.12...1.0.13) (2020-07-07) | ||
### Bug Fixes | ||
* remove definitions key after dereffing ([ed43c3f](https://github.com/json-schema-tools/dereferencer/commit/ed43c3f8f36d83a576713f1300e8b91d65ae9e59)) | ||
## [1.0.12](https://github.com/json-schema-tools/dereferencer/compare/1.0.11...1.0.12) (2020-07-07) | ||
@@ -2,0 +9,0 @@ |
{ | ||
"name": "@json-schema-tools/dereferencer", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Dereference (aka parse refs) from JSON Schemas", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -73,10 +73,15 @@ import Dereferencer from "./index"; | ||
const props = dereffed.properties as Properties; | ||
expect(props.jsonSchemaMetaSchema.type).toBeDefined(); | ||
expect(props.jsonSchemaMetaSchema.definitions.nonNegativeIntegerDefault0).toBeDefined(); | ||
expect(props.jsonSchemaMetaSchema.definitions.nonNegativeIntegerDefault0.allOf[0].$ref).toBeUndefined(); | ||
expect(props.jsonSchemaMetaSchema.definitions.nonNegativeIntegerDefault0.allOf[0].type).toBe("integer"); | ||
expect(props.jsonSchemaMetaSchema.type).toEqual(["object", "boolean"]); | ||
expect(props.jsonSchemaMetaSchema.properties.maxLength.title) | ||
.toBe("nonNegativeInteger"); | ||
expect(props.jsonSchemaMetaSchema.properties.minItems.title) | ||
.toBe("nonNegativeIntegerDefaultZero"); | ||
expect(props.jsonSchemaMetaSchema.properties.dependencies.additionalProperties.anyOf[0]) | ||
.toBe(props.jsonSchemaMetaSchema); | ||
}); | ||
it("can deal with root refs-to-ref as url", async () => { | ||
expect.assertions(6); | ||
expect.assertions(8); | ||
const dereferencer = new Dereferencer({ | ||
@@ -92,2 +97,6 @@ $ref: "https://raw.githubusercontent.com/json-schema-tools/meta-schema/master/meta-schema.json", | ||
expect((dereffed.properties as Properties).additionalItems).toBe(dereffed); | ||
expect( | ||
(dereffed.properties as Properties).minProperties.title | ||
).toBe("nonNegativeIntegerDefaultZero"); | ||
expect(dereffed.definitions).toBeUndefined(); | ||
}); | ||
@@ -94,0 +103,0 @@ |
@@ -204,2 +204,3 @@ import { JSONMetaSchema } from "@json-schema-tools/meta-schema"; | ||
if (this.refs.length === 0) { | ||
delete this.schema.definitions; | ||
return Promise.resolve(this.schema); | ||
@@ -206,0 +207,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90237
1194