From bf9bc2ae49d56fa25e2d310543505c8b40040b7b Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sun, 20 May 2018 12:13:05 -0700 Subject: [PATCH] registration: Validate AutoloadNamespaces keys have trailing \ The PSR-4 autoloader requires "AutoloadNamespaces" keys to have a trailing \ (\\ in JSON), so add a validation check for that. Unfortunately the validation error isn't great, since it checks to see if the property matches patternProperties, and when it doesn't, it claims the property isn't defined since additionalProperties is false. But it's still better than not failing when they are missing. Bug: T189136 Change-Id: If01bd06cdd767fb704a8ff85cdf1c143e53fa4ca --- docs/extension.schema.v1.json | 8 +++++++- docs/extension.schema.v2.json | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/extension.schema.v1.json b/docs/extension.schema.v1.json index 0763e7de63..bcfd2aa3d5 100644 --- a/docs/extension.schema.v1.json +++ b/docs/extension.schema.v1.json @@ -569,7 +569,13 @@ }, "AutoloadNamespaces": { "type": "object", - "description": "Mapping of PSR-4 compliant namespace to directory for autoloading" + "description": "Mapping of PSR-4 compliant namespace to directory for autoloading", + "patternProperties": { + "^[A-Za-z0-9\\\\]+\\\\$": { + "type": "string" + } + }, + "additionalProperties": false }, "AutoloadClasses": { "type": "object" diff --git a/docs/extension.schema.v2.json b/docs/extension.schema.v2.json index e13129bb56..31edbd09dd 100644 --- a/docs/extension.schema.v2.json +++ b/docs/extension.schema.v2.json @@ -590,7 +590,13 @@ }, "AutoloadNamespaces": { "type": "object", - "description": "Mapping of PSR-4 compliant namespace to directory for autoloading" + "description": "Mapping of PSR-4 compliant namespace to directory for autoloading", + "patternProperties": { + "^[A-Za-z0-9\\\\]+\\\\$": { + "type": "string" + } + }, + "additionalProperties": false }, "AutoloadClasses": { "type": "object" -- 2.20.1