From 0b4b2100da75c9e01e9e52ca53aa04bfeec61755 Mon Sep 17 00:00:00 2001 From: Jason N Date: Mon, 13 May 2024 09:09:05 +1000 Subject: [PATCH] Add missing fznjson schema --- public/schemas/fznjson/index.json | 163 ++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 public/schemas/fznjson/index.json diff --git a/public/schemas/fznjson/index.json b/public/schemas/fznjson/index.json new file mode 100644 index 000000000..ffd1bb009 --- /dev/null +++ b/public/schemas/fznjson/index.json @@ -0,0 +1,163 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "$id": "https://www.minizinc.org/schemas/fznjson", + "title" : "FlatZincJSON", + "description" : "A JSON representation of a FlatZinc model", + + "$defs" : { + "identifier" : { "type" : "string", "pattern" : "[A-Za-z][A-Za-z0-9_]*" }, + "literal" : { "oneOf" : [ + { "type" : "number" }, + { "$ref" : "#/$defs/identifier" }, + { "type" : "boolean" }, + { "type" : "object", + "properties" : { + "set" : { + "type" : "array", + "items" : { + "type" : "array", + "items" : [ + { "type" : "number" }, + { "type" : "number" } + ] + } + } + }, + "required" : [ "set" ] + }, + { "type" : "object", + "properties" : { + "string" : { "type" : "string" } + }, + "required" : [ "string" ] + } + ]}, + "literals" : { "type" : "array", "items" : { "$ref" : "#/$defs/literal" } }, + "argument" : { "oneOf" : [ + { "$ref" : "#/$defs/literals"}, + { "$ref" : "#/$defs/literal" } + ]}, + "annotation" : { "oneOf" : [ + { "$ref" : "#/$defs/call" }, + { "type" : "string" } + ]}, + "annotations" : { + "type" : "array", + "items" : { "$ref" : "#/$defs/annotation" } + }, + "call" : { + "type" : "object", + "properties" : { + "id": { "$ref": "#/$defs/identifier" }, + "args": { + "type": "array", + "items": { "$ref" : "#/$defs/argument" } + }, + "ann" : { "$ref" : "#/$defs/annotations"} + }, + "required": [ + "id", + "args" + ] + }, + "domain" : { + "type" : "array", + "items" : { + "type" : "array", + "items" : [ + { "type" : "number" }, + { "type" : "number" } + ] + } + } + }, + + "type": "object", + "properties": { + "version" : { "type" : "string" }, + "variables": { + "type": "object", + "patternProperties": { + "[A-Za-z][A-Za-z0-9_]*": { + "type": "object", + "properties": { + "type": { + "enum": [ + "bool", + "float", + "int", + "set of int" + ] + }, + "domain": { "$ref" : "#/$defs/domain" }, + "rhs": { "$ref" : "#/$defs/literal" }, + "introduced": { + "type": "boolean" + }, + "defined": { + "type": "boolean" + }, + "ann" : { "$ref" : "#/$defs/annotations"} + }, + "required": [ + "type" + ] + } + } + }, + "arrays": { + "type": "object", + "patternProperties": { + "[A-Za-z][A-Za-z0-9_]*": { + "type": "object", + "properties": { + "a": { + "type": "array", + "items": { "$ref" : "#/$defs/literal" } + }, + "ann" : { "$ref" : "#/$defs/annotations"}, + "introduced": { + "type": "boolean" + }, + "defined": { + "type": "boolean" + } + }, + "required": [ + "a" + ] + } + } + }, + "constraints": { + "type": "array", + "items": { "$ref" : "#/$defs/call" } + }, + "output": { + "type": "array", + "items": { "$ref" : "#/$defs/identifier" } + }, + "solve": { + "type": "object", + "properties": { + "method": { + "enum": [ "satisfy", "minimize", "maximize" ] + }, + "objective": { "$ref" : "#/$defs/literal" }, + "ann" : { "$ref" : "#/$defs/annotations"} + }, + "required": [ + "method" + ] + } + }, + "required": [ + "version", + "variables", + "arrays", + "output", + "constraints", + "solve" + ] + } + \ No newline at end of file