-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from bollwyvl/add-server-status-endpoint
Add server status endpoint
- Loading branch information
Showing
8 changed files
with
235 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import json | ||
import pathlib | ||
|
||
import jsonschema | ||
|
||
HERE = pathlib.Path(__file__).parent | ||
|
||
|
||
def servers_schema() -> jsonschema.validators.Draft7Validator: | ||
""" return a JSON Schema Draft 7 validator for the server status API | ||
""" | ||
return jsonschema.validators.Draft7Validator( | ||
json.loads((HERE / "servers.schema.json").read_text()) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$ref": "#/definitions/servers-response", | ||
"title": "jupyter_lsp server status response", | ||
"description": "describes the current state of (potentially) running language servers", | ||
"definitions": { | ||
"servers-response": { | ||
"type": "object", | ||
"properties": { | ||
"sessions": { | ||
"type": "array", | ||
"description": "a list of servers that are, could be, or were running", | ||
"items": { "$ref": "#/definitions/session" } | ||
}, | ||
"version": { | ||
"type": "integer", | ||
"description": "the version of the schema", | ||
"enum": [0] | ||
} | ||
}, | ||
"required": ["sessions", "version"] | ||
}, | ||
"nullable-date-time": { | ||
"description": "a date/time that might not have been recorded", | ||
"oneOf": [{ "type": "string", "format": "date-time" }, { "type": "null" }] | ||
}, | ||
"session": { | ||
"title": "Language Server Session", | ||
"description": "a language server session", | ||
"additionalProperties": false, | ||
"required": [ | ||
"languages", | ||
"handler_count", | ||
"status", | ||
"last_server_message_at", | ||
"last_handler_message_at" | ||
], | ||
"properties": { | ||
"languages": { | ||
"description": "languages supported by this Language Server", | ||
"type": "array", | ||
"items": { "type": "string" }, | ||
"uniqueItems": true, | ||
"minItems": 1 | ||
}, | ||
"handler_count": { | ||
"title": "handler count", | ||
"description": "the count of currently-connected WebSocket handlers", | ||
"type": "integer", | ||
"minValue": 0 | ||
}, | ||
"status": { | ||
"description": "a string describing the current state of the server", | ||
"type": "string", | ||
"enum": ["not_started", "starting", "started", "stopping", "stopped"] | ||
}, | ||
"last_server_message_at": { | ||
"description": "date-time of last seen message from the language server", | ||
"$ref": "#/definitions/nullable-date-time" | ||
}, | ||
"last_handler_message_at": { | ||
"description": "date-time of last seen message from a WebSocket handler", | ||
"$ref": "#/definitions/nullable-date-time" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.