schema: introduce element
Introduce a new sub schema "EMExposesElement" that enables stricter
validation of Exposes entry elements. The existing aggregate subschema
checks element properties but cannot check that specific combinations of
properties are allowed in the same element. Require that each element
have at a minimum a Type and Name property.
Add documentation that describes an overview and best practices when
adding new schema.
Change-Id: If0a11ac9acde8e574070cccd9bf8d017b6c8e3b1
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/schemas/global.json b/schemas/global.json
index 911c692..eb1af51 100644
--- a/schemas/global.json
+++ b/schemas/global.json
@@ -1,6 +1,43 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
+ "EMExposesElement": {
+ "description": [
+ "The exposes property element schema. An element of the exposes ",
+ "property is always an array where elements are of type exposes ",
+ "entry."
+ ],
+ "oneOf": [
+ {
+ "$ref": "legacy.json#/definitions/Aggregate"
+ },
+ {
+ "description": [
+ "Ensure the parent oneOf schema does not validate ",
+ "when an element does not define a type property."
+ ],
+ "not": {
+ "required": [
+ "Type"
+ ]
+ },
+ "title": "Missing Type"
+ },
+ {
+ "description": [
+ "Ensure the parent oneOf schema does not validate ",
+ "when an element does not define a name property."
+ ],
+ "not": {
+ "required": [
+ "Name"
+ ]
+ },
+ "title": "Missing Name"
+ }
+ ],
+ "title": "Exposes Property Element"
+ },
"EMConfig": {
"title": "Entity Manager Configuration",
"description": [
@@ -26,7 +63,7 @@
],
"type": "array",
"items": {
- "$ref": "legacy.json#/definitions/Aggregate"
+ "$ref": "#/definitions/EMExposesElement"
}
},
"Logging": {