diff --git a/schema/klighd/SKGraphSchema.json b/schema/klighd/SKGraphSchema.json index 5305f351..8e38b258 100644 --- a/schema/klighd/SKGraphSchema.json +++ b/schema/klighd/SKGraphSchema.json @@ -3,6 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "SKElement", "type": "object", + "required": ["data", "properties", "type"], "properties": { "data": { "type": "array", @@ -24,6 +25,7 @@ "definitions": { "SModelElement": { "type": "object", + "required": ["type", "id", "children"], "properties": { "type": { "type": "string" @@ -47,6 +49,7 @@ }, "SShapeElement": { "allOf": [{"$ref": "#/definitions/SModelElement"}], + "required": ["size"], "properties": { "size": { "type": "object", @@ -65,6 +68,7 @@ }, "SKGraph": { "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "revision"], "properties": { "type": { "type": "string", @@ -77,6 +81,7 @@ }, "SKNode": { "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SShapeElement"}], + "required": ["type"], "properties": { "type": { "type": "string", @@ -86,6 +91,7 @@ }, "SKLabel": { "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "text"], "properties": { "text": { "type": "string" @@ -98,6 +104,7 @@ }, "SKEdge": { "allOf": [{"$ref": "#"}, {"$ref": "#/definitions/SModelElement"}], + "required": ["type", "sourceId", "targetId"], "properties": { "sourceId": { "type": "string" diff --git a/schema/klighd/actions/setSyntheses.json b/schema/klighd/actions/setSyntheses.json index 021faf00..37aae4a3 100644 --- a/schema/klighd/actions/setSyntheses.json +++ b/schema/klighd/actions/setSyntheses.json @@ -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", @@ -19,6 +20,7 @@ "definitions": { "synthesis": { "type": "object", + "required": ["id", "displayName"], "properties": { "id": { "type": "string" diff --git a/schema/klighd/actions/updateOptions.json b/schema/klighd/actions/updateOptions.json index 3a2b6f39..b570d319 100644 --- a/schema/klighd/actions/updateOptions.json +++ b/schema/klighd/actions/updateOptions.json @@ -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", @@ -28,6 +29,7 @@ "definitions": { "ValuedSynthesisOption": { "type": "object", + "required": ["synthesisOption", "currentValue"], "properties": { "synthesisOption": { "anyOf": [ @@ -46,8 +48,8 @@ }, "SynthesisOption": { "type": "object", + "required": ["id", "name", "type", "sourceHash", "initialValue"], "properties": { - "id": { "type": "string" }, @@ -55,7 +57,8 @@ "type": "string" }, "type": { - "type": "number" + "type": "number", + "enum": [0, 1, 2, 3, 4, 5] }, "updateAction": { "type": "string" @@ -83,6 +86,7 @@ }, "choiceSynthesisOption": { "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "required": ["values"], "properties": { "type": { "type": "number", @@ -101,6 +105,7 @@ }, "rangeSynthesisOption": { "allOf": [{"$ref": "#/definitions/SynthesisOption"}], + "required": ["range", "stepSize"], "properties": { "type": { "type": "number", diff --git a/schema/klighd/messages/setPreferences.json b/schema/klighd/messages/setPreferences.json index 75a37b7a..75c6b943 100644 --- a/schema/klighd/messages/setPreferences.json +++ b/schema/klighd/messages/setPreferences.json @@ -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" diff --git a/schema/lsp/initialize.json b/schema/lsp/initialize.json index 8d9f2e8d..ae7b5766 100644 --- a/schema/lsp/initialize.json +++ b/schema/lsp/initialize.json @@ -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"] diff --git a/schema/lsp/message.json b/schema/lsp/message.json new file mode 100644 index 00000000..ef38af37 --- /dev/null +++ b/schema/lsp/message.json @@ -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"] + } + } +} \ No newline at end of file diff --git a/schema/lsp/requestMessage.json b/schema/lsp/requestMessage.json new file mode 100644 index 00000000..1fa41a01 --- /dev/null +++ b/schema/lsp/requestMessage.json @@ -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"] + } + } +} \ No newline at end of file diff --git a/schema/lsp/responseMessage.json b/schema/lsp/responseMessage.json new file mode 100644 index 00000000..48db567e --- /dev/null +++ b/schema/lsp/responseMessage.json @@ -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": {} + } +} \ No newline at end of file diff --git a/schema/sprotty/actions/action.json b/schema/sprotty/actions/action.json index 48f6c51b..067295b0 100644 --- a/schema/sprotty/actions/action.json +++ b/schema/sprotty/actions/action.json @@ -3,6 +3,7 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "action", "type": "object", + "required": ["kind"], "properties": { "kind": { "type": "string" diff --git a/schema/sprotty/actions/requestBounds.json b/schema/sprotty/actions/requestBounds.json index 8eb97ad9..9ad3dd50 100644 --- a/schema/sprotty/actions/requestBounds.json +++ b/schema/sprotty/actions/requestBounds.json @@ -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" } } } \ No newline at end of file diff --git a/schema/sprotty/actions/requestModel.json b/schema/sprotty/actions/requestModel.json index f9e1564f..1aebcb5b 100644 --- a/schema/sprotty/actions/requestModel.json +++ b/schema/sprotty/actions/requestModel.json @@ -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" } + } } \ No newline at end of file diff --git a/schema/sprotty/diagramAccept.json b/schema/sprotty/diagramAccept.json index 8af36a81..531bb740 100644 --- a/schema/sprotty/diagramAccept.json +++ b/schema/sprotty/diagramAccept.json @@ -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",