From 00f6295413d073ea2a2872c86a98684521642c53 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Sat, 23 Mar 2019 08:44:18 +0100 Subject: [PATCH] refactor(schema): default after definition --- bin/create-json-schema.js | 28 +++++++++++++++++----------- renovate-schema.json | 26 ++++++++------------------ 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/bin/create-json-schema.js b/bin/create-json-schema.js index 7eef0a6b03..0b85fdc92b 100644 --- a/bin/create-json-schema.js +++ b/bin/create-json-schema.js @@ -26,23 +26,29 @@ function createSingleConfig(option) { temp.description = option.description; } temp.type = types[option.type]; - if (temp.type === 'array' && option.subType) { - temp.items = { - type: types[option.subType], - }; + if (temp.type === 'array') { + if (option.subType) { + temp.items = { + type: types[option.subType], + }; + if (option.format) { + temp.items.format = option.format; + } + if (option.allowedValues) { + temp.items.enum = option.allowedValues; + } + } + } else { if (option.format) { - temp.items.format = option.format; + temp.format = option.format; + } + if (option.allowedValues) { + temp.enum = option.allowedValues; } - } - if (option.format && temp.type !== 'array') { - temp.format = option.format; } if (option.default !== undefined) { temp.default = option.default; } - if (option.allowedValues) { - temp.enum = option.allowedValues; - } if (temp.type === 'object') { temp.$ref = '#'; } diff --git a/renovate-schema.json b/renovate-schema.json index 0b1fa85a33..c7f0f89806 100644 --- a/renovate-schema.json +++ b/renovate-schema.json @@ -121,8 +121,8 @@ "gitFs": { "description": "Use git for FS operations instead of API. GitHub only.", "type": "string", - "default": null, - "enum": ["https", "http", "ssh"] + "enum": ["https", "http", "ssh"], + "default": null }, "trustLevel": { "description": "Set this to \"high\" if the bot should trust the repository owners/contents", @@ -240,7 +240,6 @@ "versionScheme": { "description": "Version scheme to use for filtering and comparisons", "type": "string", - "default": "semver", "enum": [ "cargo", "composer", @@ -254,7 +253,8 @@ "pep440", "ruby", "semver" - ] + ], + "default": "semver" }, "ignoreDeps": { "description": "Dependencies to ignore", @@ -414,8 +414,8 @@ "rangeStrategy": { "description": "Policy for how to modify/update existing ranges.", "type": "string", - "default": "replace", - "enum": ["auto", "pin", "bump", "replace", "widen", "update-lockfile"] + "enum": ["auto", "pin", "bump", "replace", "widen", "update-lockfile"], + "default": "replace" }, "branchPrefix": { "description": "Prefix to use for all branch names", @@ -767,8 +767,7 @@ "postUpdateOptions": { "description": "Enable post-update options to be run after package/artifact updating", "type": "array", - "default": [], - "enum": ["gomodTidy", "npmDedupe", "yarnDedupeFewer", "yarnDedupeHighest"] + "default": [] }, "ruby": { "description": "Configuration object for ruby language", @@ -1079,16 +1078,7 @@ "suppressNotifications": { "description": "Options to suppress various types of warnings and other notifications", "type": "array", - "default": [], - "enum": [ - "prIgnoreNotification", - "prEditNotification", - "branchAutomergeFailure", - "lockFileErrors", - "artifactErrors", - "deprecationWarningIssues", - "onboardingClose" - ] + "default": [] } } } -- GitLab