From 01e02ff22fc74f0c7ecd0bf582df773385d3e04d Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sun, 31 Mar 2019 09:16:29 +0200 Subject: [PATCH] fix(schema): add freeChoice --- bin/create-json-schema.js | 2 +- lib/config/definitions.js | 1 + lib/config/validation.js | 19 ++++++++++++------- renovate-schema.json | 3 +-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bin/create-json-schema.js b/bin/create-json-schema.js index fde39379be..c6c8ecb938 100644 --- a/bin/create-json-schema.js +++ b/bin/create-json-schema.js @@ -40,7 +40,7 @@ function createSingleConfig(option) { if (option.default !== undefined) { temp.default = option.default; } - if (temp.type === 'object') { + if (temp.type === 'object' && !option.freeChoice) { temp.$ref = '#'; } return temp; diff --git a/lib/config/definitions.js b/lib/config/definitions.js index 0f82c38271..69cd6144b8 100644 --- a/lib/config/definitions.js +++ b/lib/config/definitions.js @@ -1553,6 +1553,7 @@ const options = [ name: 'prBodyDefinitions', description: 'Table column definitions for use in PR tables', type: 'object', + freeChoice: true, mergeable: true, default: { Package: '{{{depName}}}', diff --git a/lib/config/validation.js b/lib/config/validation.js index 9bd7425e69..c177fc1dd5 100644 --- a/lib/config/validation.js +++ b/lib/config/validation.js @@ -259,13 +259,18 @@ async function validateConfig(config, isPreset, parentPath) { } } else if (type === 'object') { if (is.object(val)) { - const subValidation = await module.exports.validateConfig( - val, - isPreset, - currentPath - ); - warnings = warnings.concat(subValidation.warnings); - errors = errors.concat(subValidation.errors); + const ignoredObjects = options + .filter(option => option.freeChoice) + .map(option => option.name); + if (!ignoredObjects.includes(key)) { + const subValidation = await module.exports.validateConfig( + val, + isPreset, + currentPath + ); + warnings = warnings.concat(subValidation.warnings); + errors = errors.concat(subValidation.errors); + } } else { errors.push({ depName: 'Configuration Error', diff --git a/renovate-schema.json b/renovate-schema.json index 03a11f99d2..abe6b91b2e 100644 --- a/renovate-schema.json +++ b/renovate-schema.json @@ -1073,8 +1073,7 @@ "Change": "{{#if displayFrom}}`{{{displayFrom}}}` -> {{else}}{{#if currentValue}}`{{{currentValue}}}` -> {{/if}}{{/if}}{{#if displayTo}}`{{{displayTo}}}`{{else}}`{{{newValue}}}`{{/if}}", "References": "{{{references}}}", "Package file": "{{{packageFile}}}" - }, - "$ref": "#" + } }, "prBodyColumns": { "description": "List of columns to use in PR bodies", -- GitLab