{ "$schema": "http://json-schema.org/draft-07/schema", "$id": "task-db", "title": "Task Document", "description": "A Task document as it is stored in the database.", "required": [ "_id", "job", "location", "view", "status", "app", "name", "type", "variables", "metrics", "groups" ], "propertyNames": { "anyOf": [ { "$ref": "task-common#/definitions/commonFieldNames" }, { "enum": [ "groups", "type", "metrics" ] } ] }, "allOf": [ { "$ref": "task-common#/definitions/commonFields" }, { "type": "object", "properties": { "groups": { "type": "array", "items": { "$ref": "common#/definitions/ObjectId" } } } }, { "oneOf": [ { "$ref": "#/definitions/manual" }, { "$ref": "#/definitions/operation" }, { "$ref": "#/definitions/automatic" } ] } ], "definitions": { "account-db": { "oneOf": [ { "$ref": "common#/definitions/account-identifier" }, { "$ref": "common#/definitions/ObjectId" }, { "const": "" } ] }, "metrics-accounts-db": { "type": "object", "properties": { "user": { "$ref": "#/definitions/account-db" }, "owner": { "$ref": "#/definitions/account-db" } } }, "manual": { "type": "object", "properties": { "type": { "const": "manual" }, "metrics": { "allOf": [ { "$ref": "task-common#/definitions/metrics-common-manual" }, { "$ref": "#/definitions/metrics-accounts-db" } ] } } }, "operation": { "type": "object", "properties": { "type": { "const": "operation" }, "metrics": { "allOf": [ { "$ref": "task-common#/definitions/metrics-common-operation-automatic" }, { "$ref": "#/definitions/metrics-accounts-db" } ] } } }, "automatic": { "type": "object", "properties": { "type": { "const": "automatic" }, "metrics": { "allOf": [ { "$ref": "task-common#/definitions/metrics-common-operation-automatic" }, { "$ref": "#/definitions/metrics-accounts-db" } ] } } } } }