Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pushed new JSON-Schema #5

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
263 changes: 263 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
chainlist marked this conversation as resolved.
Show resolved Hide resolved
"default": {
"edges": [],
"nodes": []
},
"properties": {
"required": true,
chainlist marked this conversation as resolved.
Show resolved Hide resolved
"edges": {
"items": {
"$ref": "#/definitions/JSONCanvasEdge"
},
"type": "array"
},
"nodes": {
"items": {
"$ref": "#/definitions/JSONCanvasNode"
},
"type": "array"
}
},
"definitions": {
chainlist marked this conversation as resolved.
Show resolved Hide resolved
"JSONCanvasColor": {
"anyOf": [
{
"type": "string"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
{
"$ref": "#/definitions/JSONCanvasColorPreset"
}
]
},
"JSONCanvasColorPreset": {
"enum": [1, 2, 3, 4, 5, 6],
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"JSONCanvasEdge": {
"additionalProperties": false,
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
"fromNode": {
"type": "string"
},
"fromSide": {
"$ref": "#/definitions/JSONCanvasEdgeSide"
},
"id": {
"type": "string"
},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define a NodeId schema. That will help to give semantic info to properties like fromNode.

"label": {
"type": "string"
},
"toEnd": {
"$ref": "#/definitions/JSONCanvasEdgeEnd"
},
"toNode": {
"type": "string"
},
"toSide": {
"$ref": "#/definitions/JSONCanvasEdgeSide"
}
},
"required": ["id", "fromNode", "toNode"],
"type": "object"
},
"JSONCanvasEdgeEnd": {
"enum": ["none", "arrow"],
"type": "string"
},
"JSONCanvasEdgeSide": {
"enum": ["top", "right", "bottom", "left"],
"type": "string"
},
"JSONCanvasFileNode": {
"additionalProperties": false,
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
"file": {
"type": "string"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"height": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"id": {
"type": "string"
},
"subpath": {
"type": "string"
},
"type": {
"const": "file",
"type": "string"
},
"width": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"x": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"y": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
}
},
"required": ["file", "height", "id", "type", "width", "x", "y"],
"type": "object"
},
"JSONCanvasGroupNode": {
"additionalProperties": false,
"properties": {
"background": {
"type": "string"
},
"backgroundStyle": {
"enum": ["cover", "ratio", "repeat"],
"type": "string"
},
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
"height": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"id": {
"type": "string"
},
"label": {
"type": "string"
},
"type": {
"const": "group",
"type": "string"
},
"width": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"x": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"y": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
}
},
"required": ["height", "id", "type", "width", "x", "y"],
"type": "object"
},
"JSONCanvasLinkNode": {
"additionalProperties": false,
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
"height": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"id": {
"type": "string"
},
"type": {
"const": "link",
"type": "string"
},
"url": {
"type": "string"
},
"width": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"x": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"y": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
}
},
"required": ["height", "id", "type", "url", "width", "x", "y"],
"type": "object"
},
"JSONCanvasNode": {
"anyOf": [
{
"$ref": "#/definitions/JSONCanvasNodeType"
},
{
"$ref": "#/definitions/JSONCanvasTextNode"
},
{
"$ref": "#/definitions/JSONCanvasFileNode"
},
{
"$ref": "#/definitions/JSONCanvasLinkNode"
},
{
"$ref": "#/definitions/JSONCanvasGroupNode"
}
]
},
"JSONCanvasNodeType": {
"additionalProperties": false,
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
"height": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"id": {
"type": "string"
},
"type": {
"enum": ["text", "file", "link", "group"],
"type": "string"
},
"width": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"x": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"y": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
}
},
"required": ["id", "type", "x", "y", "width", "height"],
"type": "object"
},
"JSONCanvasTextNode": {
"additionalProperties": false,
"properties": {
"color": {
"$ref": "#/definitions/JSONCanvasColor"
},
"height": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"id": {
"type": "string"
},
"text": {
"type": "string"
},
"type": {
"const": "text",
"type": "string"
},
"width": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"x": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
},
"y": {
"type": "number"
chainlist marked this conversation as resolved.
Show resolved Hide resolved
}
},
"required": ["height", "id", "text", "type", "width", "x", "y"],
"type": "object"
}
}
}