Skip to content

Commit

Permalink
Add missing fznjson schema
Browse files Browse the repository at this point in the history
  • Loading branch information
cyderize committed May 12, 2024
1 parent 45d98f5 commit 0b4b210
Showing 1 changed file with 163 additions and 0 deletions.
163 changes: 163 additions & 0 deletions public/schemas/fznjson/index.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

0 comments on commit 0b4b210

Please sign in to comment.