Skip to content

Commit

Permalink
update schemas with required fields and add lsp message types
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddykasp committed Oct 10, 2024
1 parent 19dd1f1 commit 48c49db
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 60 deletions.
7 changes: 7 additions & 0 deletions schema/klighd/SKGraphSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "SKElement",
"type": "object",
"required": ["data", "properties", "type"],
"properties": {
"data": {
"type": "array",
Expand All @@ -24,6 +25,7 @@
"definitions": {
"SModelElement": {
"type": "object",
"required": ["type", "id", "children"],
"properties": {
"type": {
"type": "string"
Expand All @@ -47,6 +49,7 @@
},
"SShapeElement": {
"allOf": [{"$ref": "#/definitions/SModelElement"}],
"required": ["size"],
"properties": {
"size": {
"type": "object",
Expand All @@ -65,6 +68,7 @@
},
"SKGraph": {
"allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}],
"required": ["type", "revision"],
"properties": {
"type": {
"type": "string",
Expand All @@ -77,6 +81,7 @@
},
"SKNode": {
"allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SShapeElement"}],
"required": ["type"],
"properties": {
"type": {
"type": "string",
Expand All @@ -86,6 +91,7 @@
},
"SKLabel": {
"allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}],
"required": ["type", "text"],
"properties": {
"text": {
"type": "string"
Expand All @@ -98,6 +104,7 @@
},
"SKEdge": {
"allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}],
"required": ["type", "sourceId", "targetId"],
"properties": {
"sourceId": {
"type": "string"
Expand Down
2 changes: 2 additions & 0 deletions schema/klighd/actions/setSyntheses.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "setSyntheses",
"type": "object",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}],
"required": ["kind", "syntheses"],
"properties": {
"kind": {
"type": "string",
Expand All @@ -19,6 +20,7 @@
"definitions": {
"synthesis": {
"type": "object",
"required": ["id", "displayName"],
"properties": {
"id": {
"type": "string"
Expand Down
9 changes: 7 additions & 2 deletions schema/klighd/actions/updateOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "updateOptions",
"type": "object",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/action.json"}],
"required": ["kind", "valuedSynthesisOptions", "layoutOptions", "actions", "modelUri"],
"properties": {
"kind": {
"type": "string",
Expand All @@ -28,6 +29,7 @@
"definitions": {
"ValuedSynthesisOption": {
"type": "object",
"required": ["synthesisOption", "currentValue"],
"properties": {
"synthesisOption": {
"anyOf": [
Expand All @@ -46,16 +48,17 @@
},
"SynthesisOption": {
"type": "object",
"required": ["id", "name", "type", "sourceHash", "initialValue"],
"properties": {

"id": {
"type": "string"
},
"name": {
"type": "string"
},
"type": {
"type": "number"
"type": "number",
"enum": [0, 1, 2, 3, 4, 5]
},
"updateAction": {
"type": "string"
Expand Down Expand Up @@ -83,6 +86,7 @@
},
"choiceSynthesisOption": {
"allOf": [{"$ref": "#/definitions/SynthesisOption"}],
"required": ["values"],
"properties": {
"type": {
"type": "number",
Expand All @@ -101,6 +105,7 @@
},
"rangeSynthesisOption": {
"allOf": [{"$ref": "#/definitions/SynthesisOption"}],
"required": ["range", "stepSize"],
"properties": {
"type": {
"type": "number",
Expand Down
7 changes: 3 additions & 4 deletions schema/klighd/messages/setPreferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
"$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/klighd/messages/setPreferences.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "keith/preferences/setPreferences",
"type": "object",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}],
"required": ["method", "params"],
"properties": {
"jsonrpc": {
"type": "string"
},
"method": {
"type": "string",
"enum": ["keith/preferences/setPreferences"]
},
"params": {
"type": "object",
"required": ["diagram.shouldSelectDiagram", "diagram.shouldSelectText", "diagram.incrementalDiagramGenerator"],
"properties": {
"diagram.shouldSelectDiagram": {
"type": "boolean"
Expand Down
9 changes: 2 additions & 7 deletions schema/lsp/initialize.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
"$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/initialize.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "initialize",
"type": "object",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/requestMessage.json"}],
"required": ["method", "params"],
"properties": {
"jsonrpc": {
"type": "string"
},
"id": {
"type": "number"
},
"method": {
"type": "string",
"enum": ["initialize"]
Expand Down
13 changes: 13 additions & 0 deletions schema/lsp/message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/message.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "message",
"type": "object",
"required": ["jsonrpc"],
"properties": {
"jsonrpc": {
"type": "string",
"enum": ["2.0"]
}
}
}
19 changes: 19 additions & 0 deletions schema/lsp/requestMessage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/requestmessage.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "message",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/message.json"}],
"required": ["id", "method"],
"properties": {
"id": {
"type": ["number", "string"]
},
"method": {
"type": "string",
"enum": ["requestMessage"]
},
"params": {
"type": ["array", "object"]
}
}
}
15 changes: 15 additions & 0 deletions schema/lsp/responseMessage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/lsp/requestmessage.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "message",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/lsp/message.json"}],
"required": ["id"],
"oneOf": [{"required": ["result"]}, {"required": ["error"]}],
"properties": {
"id": {
"type": ["number", "string", "null"]
},
"result": {},
"error": {}
}
}
1 change: 1 addition & 0 deletions schema/sprotty/actions/action.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "action",
"type": "object",
"required": ["kind"],
"properties": {
"kind": {
"type": "string"
Expand Down
21 changes: 2 additions & 19 deletions schema/sprotty/actions/requestBounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,14 @@
"title": "requestBounds",
"type": "object",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}],
"required": ["kind", "newRoot"],
"properties": {
"kind": {
"type": "string",
"enum": ["requestBounds"]
},
"newRoot": {
"type": "object",
"properties": {
"properties": {},
"revision": {
"type": "number"
},
"type": {
"type": "string"
},
"id": {
"type": "string"
},
"children": {
"type": "array",
"items": {
"$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph"
}
}
}
"$ref": "/kieler/klighd-vscode/tree/main/schema/klighd/SKGraphSchema#/definitions/SKGraph"
}
}
}
49 changes: 25 additions & 24 deletions schema/sprotty/actions/requestModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,32 @@
"title": "requestBounds",
"type": "object",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/actions/action.json"}],
"properties": {
"kind": {
"type": "string",
"enum": ["requestModel"]
},
"options": {
"type": "object",
"properties": {
"needsClientLayout": {
"type": "boolean"
},
"needsServerLayout": {
"type": "boolean"
},
"sourceUri": {
"type": "string"
},
"diagramType": {
"type": "string",
"enum": ["keith-diagram"]
}
"required": ["kind", "options", "requestId"],
"properties": {
"kind": {
"type": "string",
"enum": ["requestModel"]
},
"options": {
"type": "object",
"properties": {
"needsClientLayout": {
"type": "boolean"
},
"needsServerLayout": {
"type": "boolean"
},
"sourceUri": {
"type": "string"
},
"diagramType": {
"type": "string",
"enum": ["keith-diagram"]
}
},
"requestId": {
"type": "string"
}
},
"requestId": {
"type": "string"
}
}
}
7 changes: 3 additions & 4 deletions schema/sprotty/diagramAccept.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
"$id": "https://github.com/kieler/klighd-vscode/tree/main/schema/sprotty/messages/diagramAccept.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "diagram/accept",
"type": "object",
"allOf": [{"$ref": "/kieler/klighd-vscode/tree/main/schema/sprotty/requestMessage.json"}],
"required": ["method", "params"],
"properties": {
"jsonrpc": {
"type": "string"
},
"method": {
"type": "string",
"enum": ["diagram/accept"]
},
"params": {
"type": "object",
"required": ["clientId", "action"],
"properties": {
"clientId": {
"type": "string",
Expand Down

0 comments on commit 48c49db

Please sign in to comment.