From: Kunal Mehta Date: Sun, 20 May 2018 19:13:05 +0000 (-0700) Subject: registration: Validate AutoloadNamespaces keys have trailing \ X-Git-Tag: 1.34.0-rc.0~5357^2 X-Git-Url: http://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=bf9bc2ae49d56fa25e2d310543505c8b40040b7b;p=lhc%2Fweb%2Fwiklou.git 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 --- 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"