From 82a9263d00e5dae04c807bbff57c437cd9a7877f Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 23 Mar 2019 08:27:46 +0100
Subject: [PATCH] fix(schema): regex arrays

---
 bin/create-json-schema.js |  5 ++++-
 lib/config/definitions.js |  2 ++
 renovate-schema.json      | 10 ++++++----
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/bin/create-json-schema.js b/bin/create-json-schema.js
index eabb8cce7e..4fd9ea8c81 100644
--- a/bin/create-json-schema.js
+++ b/bin/create-json-schema.js
@@ -30,8 +30,11 @@ function createSingleConfig(option) {
     temp.items = {
       type: types[option.subType],
     };
+    if (option.format) {
+      temp.items.format = option.format;
+    }
   }
-  if (option.format) {
+  if (option.format && temp.type !== 'array') {
     temp.format = option.format;
   }
   if (option.description) {
diff --git a/lib/config/definitions.js b/lib/config/definitions.js
index df12ac9206..4f8044f475 100644
--- a/lib/config/definitions.js
+++ b/lib/config/definitions.js
@@ -508,6 +508,7 @@ const options = [
       'Package name patterns to match. Valid only within `packageRules` object.',
     type: 'list',
     subType: 'string',
+    format: 'regex',
     allowString: true,
     stage: 'package',
     parent: 'packageRules',
@@ -521,6 +522,7 @@ const options = [
       'Package name patterns to exclude. Valid only within `packageRules` object.',
     type: 'list',
     subType: 'string',
+    format: 'regex',
     allowString: true,
     stage: 'package',
     parent: 'packageRules',
diff --git a/renovate-schema.json b/renovate-schema.json
index 1fed7aac33..9d0323a1f4 100644
--- a/renovate-schema.json
+++ b/renovate-schema.json
@@ -323,14 +323,16 @@
               "packagePatterns": {
                 "type": "array",
                 "items": {
-                  "type": "string"
+                  "type": "string",
+                  "format": "regex"
                 },
                 "description": "Package name patterns to match. Valid only within `packageRules` object."
               },
               "excludePackagePatterns": {
                 "type": "array",
                 "items": {
-                  "type": "string"
+                  "type": "string",
+                  "format": "regex"
                 },
                 "description": "Package name patterns to exclude. Valid only within `packageRules` object."
               },
@@ -692,9 +694,9 @@
     "fileMatch": {
       "type": "array",
       "items": {
-        "type": "string"
+        "type": "string",
+        "format": "regex"
       },
-      "format": "regex",
       "description": "JS RegExp pattern for matching manager files"
     },
     "js": {
-- 
GitLab