dlite-config/src/js/schema.js

111 lines
4.1 KiB
JavaScript

(function() {
var definitions = {
"time": {
"type": "string",
"format": "time"
},
"schedule_item": {
"type": "object",
"properties": {
"time": {
"$ref": "#/definitions/time",
// "description": "Start time, when this schedule item should fire"
},
"lamp": {
"type": "string",
"watch": {
"lamps": "lampmapping"
},
"enumSource": [{ "source": "lamps", "value": "{{item}}" }]
},
"color": {
"type": "string",
"watch": { "selectableColors": "colors" },
"enumSource" : [{ "source": "selectableColors", "value": "{{item.name}}" }]
// "description": "Name of the color to be shown; corresponds to color name in color definitions."
},
"mode": {
"type": "string",
// "description": "Dynamic behaviour / mode; allowed values are: OnOff",
"enum": ["OnOff", "Ramp", "Neon-on"]
}
}
}
};
var colorsProperties = {
"description": "DLite color definition",
"type": "array",
"format": "table",
"uniqueItems": true,
"disable_collapse": true,
"items": {
"type": "object",
"description": "Color definition",
"properties": {
"name": {
"type": "string",
/*"description": "Color name used as identifier"*/
},
"color": {
"type": "string",
"format": "color",
/*"description": "Color definition"*/
}
}
}
};
var lampmappingProperties = {
"type": "array",
"format": "table",
"description": "LED/Lamp names, used as identifier; order according to LED address",
"items": {
"type": "string"
}
};
var settingsProperties = {
"description": "DLite settings",
"type": "object",
"properties": {
"comment": {
"type": "string",
"format": "textarea",
"description": "Info about this schedule definition"
},
"mrclock": {
"type": "string",
"description": "Name of a MR-Clock fastclock"
},
"clock_starttime": {
"$ref": "#/definitions/time",
"description": "After boot, at which clock should this start to animate?"
},
"clock_speed": {
"type": "number",
"description": "Real time seconds for every model minute"
},
},
};
var scheduleProperties = {
"description": "DLite schedule definition",
"type": "array",
"format": "table",
// "description": "The schedule definition as an array of schedule items",
"items": { "$ref": "#/definitions/schedule_item" }
};
var schema = {
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "DLite Light Controller Configuration",
"type": "object",
"properties": {
"colors": colorsProperties,
"lampmapping": lampmappingProperties,
"settings": settingsProperties,
"schedule": scheduleProperties,
},
"definitions": definitions
};
window.schema = schema;
})();