diff --git a/schemas/scoring.schema.json b/schemas/scoring.schema.json index 72e296b..1923585 100644 --- a/schemas/scoring.schema.json +++ b/schemas/scoring.schema.json @@ -6,7 +6,10 @@ }, "schemaVersion": { "type": "number", - "const": 2 + "enum": [ + 2, + 3 + ] }, "id": { "type": "string", @@ -285,6 +288,475 @@ ], "additionalProperties": false }, + "formula": { + "type": "object", + "properties": { + "nodes": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "input" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "label": { + "type": "string", + "minLength": 1, + "maxLength": 80 + }, + "kind": { + "type": "string", + "enum": [ + "number", + "boolean", + "choice" + ], + "default": "number" + }, + "min": { + "type": "integer" + }, + "max": { + "type": "integer" + }, + "choices": { + "type": "array", + "items": { + "type": "object", + "properties": { + "label": { + "type": "string", + "minLength": 1, + "maxLength": 80 + }, + "value": { + "type": "integer" + } + }, + "required": [ + "label", + "value" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + "icon": { + "type": "string", + "maxLength": 40 + }, + "requiresOption": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + } + }, + "required": [ + "type", + "id", + "label" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "const" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "value": { + "type": "integer" + } + }, + "required": [ + "type", + "id", + "value" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "option" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "optionId": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + } + }, + "required": [ + "type", + "id", + "optionId" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "op" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "op": { + "type": "string", + "enum": [ + "add", + "sub", + "mul", + "div", + "min", + "max" + ] + }, + "args": { + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "minItems": 1, + "maxItems": 20 + } + }, + "required": [ + "type", + "id", + "op", + "args" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "table" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "arg": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "steps": { + "type": "array", + "items": { + "type": "object", + "properties": { + "min": { + "type": "integer" + }, + "points": { + "type": "integer" + } + }, + "required": [ + "min", + "points" + ], + "additionalProperties": false + }, + "minItems": 1, + "maxItems": 50 + } + }, + "required": [ + "type", + "id", + "arg", + "steps" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "compare" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "cmp": { + "type": "string", + "enum": [ + "gt", + "ge", + "lt", + "le", + "eq", + "ne" + ] + }, + "args": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": [ + { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + } + ] + } + }, + "required": [ + "type", + "id", + "cmp", + "args" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "if" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "args": { + "type": "array", + "minItems": 3, + "maxItems": 3, + "items": [ + { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + } + ] + } + }, + "required": [ + "type", + "id", + "args" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "rank" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "arg": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "order": { + "type": "string", + "enum": [ + "highest", + "lowest" + ], + "default": "highest" + } + }, + "required": [ + "type", + "id", + "arg" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "best" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "arg": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "order": { + "type": "string", + "enum": [ + "highest", + "lowest" + ], + "default": "highest" + }, + "ties": { + "type": "string", + "enum": [ + "all", + "none" + ], + "default": "all" + } + }, + "required": [ + "type", + "id", + "arg" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "type": { + "type": "string", + "const": "output" + }, + "id": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "arg": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + }, + "category": { + "type": "string", + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + } + }, + "required": [ + "type", + "id", + "arg", + "category" + ], + "additionalProperties": false + } + ] + }, + "minItems": 1, + "maxItems": 150 + }, + "layout": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": [ + "x", + "y" + ], + "additionalProperties": false + }, + "propertyNames": { + "minLength": 1, + "maxLength": 60, + "pattern": "^[a-z0-9][a-z0-9_-]*$" + } + } + }, + "required": [ + "nodes" + ], + "additionalProperties": false + }, "options": { "type": "array", "items": {