@trayio/commons 3.16.0 → 3.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -35,7 +35,7 @@ const function_1 = require("fp-ts/function");
|
|
|
35
35
|
const DynamicType_1 = require("../dynamictype/DynamicType");
|
|
36
36
|
const TypeCodec_1 = require("../codec/TypeCodec");
|
|
37
37
|
const Try_1 = require("../try/Try");
|
|
38
|
-
const ajv = new ajv_draft_04_1.default();
|
|
38
|
+
const ajv = new ajv_draft_04_1.default({ strict: false });
|
|
39
39
|
/*
|
|
40
40
|
We define additional formats for the JSON schema
|
|
41
41
|
See: https://ajv.js.org/packages/ajv-formats.html#formats
|
|
@@ -41,6 +41,7 @@ describe('DynamicSchema', () => {
|
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
required: ['name', 'age'],
|
|
44
|
+
advanced: [], // not part of json schema but the validator should not be strict with extra elements
|
|
44
45
|
};
|
|
45
46
|
invalidSchema = {
|
|
46
47
|
type: 'invalidType',
|
|
@@ -62,6 +63,7 @@ describe('DynamicSchema', () => {
|
|
|
62
63
|
describe('fromDynamicObject', () => {
|
|
63
64
|
it('should return a Right DynamicSchema when given a valid schema object', () => {
|
|
64
65
|
const result = DynamicSchema_1.DynamicSchema.fromDynamicObject(validSchema);
|
|
66
|
+
console.log(JSON.stringify(result));
|
|
65
67
|
expect(E.isRight(result)).toBe(true);
|
|
66
68
|
if (E.isRight(result)) {
|
|
67
69
|
expect(result.right).toEqual(validSchema);
|