registration: Support custom classes in "ResourceModules" schema
authorKunal Mehta <legoktm@gmail.com>
Sun, 2 Aug 2015 23:42:46 +0000 (16:42 -0700)
committerKrinkle <krinklemail@gmail.com>
Tue, 27 Oct 2015 04:45:27 +0000 (04:45 +0000)
commit7014e432cffcee992bbf8291b2003440b66b4e7d
tree9f1891de9fb6112ffbccbc39a982f7d5b44fd491
parentf796dbb59df851dca0d71de72d4a136cd716ece7
registration: Support custom classes in "ResourceModules" schema

Instead of expecting everything to be a ResourceLoaderFileModule, use
the "anyOf" property to validate against multiple schemas. The following
schemas are now allowed:
* The ResourceLoaderFileModule schema, now with the "targets" property
* A schema for ResourceLoaderImageModule
* A generic schema that requires the "class" property is set, but not to
"ResourceLoaderFileModule" or "ResourceLoaderImageModule".

The last schema will allow for any custom ResourceLoaderModule class to
be set in extension.json with arbitrary parameters.

One downside of this is that the error messages shown when a file does
not validate get a little more confusing, as it shows the error messages
for each schema it does not match.

Bug: T105236
Change-Id: I5e4bfa69c733187c7b27294c159cac05b3b92e81
docs/extension.schema.json