diff --git a/src/core/run.js b/src/core/run.js index 082ccfcf937e15a0588a87dac3a7a66b7e052233..68244643abcaf1b78f06f9ede8ff64c5cad49408 100644 --- a/src/core/run.js +++ b/src/core/run.js @@ -203,13 +203,17 @@ function run(refs, schema, container) { thunk() { const copy = utils.omitProps(sub, ['anyOf', 'oneOf']); const fixed = random.pick(mix); + utils.merge(copy, fixed); if (sub.oneOf && copy.properties) { mix.forEach(omit => { if (omit !== fixed && omit.required) { omit.required.forEach(key => { - delete copy.properties[key]; + // remove additional properties from merged schemas + if (!copy.required.includes(key)) { + delete copy.properties[key]; + } }); } }); diff --git a/tests/schema/core/issues/issue-329.json b/tests/schema/core/issues/issue-329.json index a6238a57f3f9133060f9f8f10817de6932e184a5..af9c521c35a5490f3012a667af8c5ff509081c85 100644 --- a/tests/schema/core/issues/issue-329.json +++ b/tests/schema/core/issues/issue-329.json @@ -5,6 +5,7 @@ { "description": "should resolve the schema (without $refs)", "timeout": 30000, + "online": true, "schema": { "$schema": "http://redfish.dmtf.org/schemas/v1/redfish-schema.v1_2_0.json", "title": "#AccountService.v1_2_1.AccountService", diff --git a/tests/schema/core/issues/issue-529.json b/tests/schema/core/issues/issue-529.json index 3d4ab191663a6d45e65685ea6cf3f2c2612baefd..53fdff197dbcb2f6d59e90901d81fae4e8afcd3a 100644 --- a/tests/schema/core/issues/issue-529.json +++ b/tests/schema/core/issues/issue-529.json @@ -1,9 +1,10 @@ { - "description": "...", + "description": "repeated properties between oneOf sub schemas", "tests": [ { - "description": "should ...", + "description": "should not skip required properties", "schema": { + "$schema": "http://json-schema.org/draft-06/schema#", "type": "object", "required": [ "filters" @@ -23,7 +24,6 @@ } } }, - "$schema": "http://json-schema.org/draft-06/schema#", "definitions": { "FilterAgc": { "type": "object", @@ -77,7 +77,6 @@ } } }, - "skip": true, "valid": true } ] diff --git a/tests/schema/main.spec.js b/tests/schema/main.spec.js index f14154673f006face2c2a2b7268bdbf5528da75b..1a70d517a4d9fa615efb65b79c1f0e9871ea82c7 100644 --- a/tests/schema/main.spec.js +++ b/tests/schema/main.spec.js @@ -17,6 +17,8 @@ function seed() { (only.length ? only : all).forEach(suite => { describe(`${suite.description} (${suite.file.replace(`${process.cwd()}/`, '')})`, () => { suite.tests.forEach(test => { + if (!process.env.CI && test.online) return; + it(test.description, () => { jsf.option(jsf.option.getDefaults()); diff --git a/tests/schema/validator.js b/tests/schema/validator.js index abbd29464ceb27c923208e5baad01ded16062f01..fb3bab99eda2d29bf674e7ead9201a4fec57ef2f 100644 --- a/tests/schema/validator.js +++ b/tests/schema/validator.js @@ -72,7 +72,7 @@ export function checkSchema(sample, schema, refs) { // z-schema const validator = new ZSchema({ - ignoreUnresolvableReferences: false, + ignoreUnresolvableReferences: true, }); Object.keys(fixed).forEach(k => {