Skip to content

Commit ddd2d7d

Browse files
committed
Workspaces: more docs
1 parent 7282eca commit ddd2d7d

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

coderd/apidoc/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ const docTemplate = `{
482482
}
483483
],
484484
"produces": [
485-
"application/json"
485+
"text/event-stream"
486486
],
487487
"tags": [
488488
"Workspaces"

coderd/apidoc/swagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@
428428
"CoderSessionToken": []
429429
}
430430
],
431-
"produces": ["application/json"],
431+
"produces": ["text/event-stream"],
432432
"tags": ["Workspaces"],
433433
"summary": "Watch workspace by ID",
434434
"operationId": "watch-workspace-id",

coderd/workspaces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ func (api *API) putExtendWorkspace(rw http.ResponseWriter, r *http.Request) {
884884
// @Summary Watch workspace by ID
885885
// @ID watch-workspace-id
886886
// @Security CoderSessionToken
887-
// @Produce application/json
887+
// @Produce text/event-stream
888888
// @Tags Workspaces
889889
// @Param workspace path string true "Workspace ID" format(uuid)
890890
// @Success 200 {object} codersdk.Response

docs/api/workspaces.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ To perform this operation, you must be authenticated by means of one of the foll
852852
```shell
853853
# Example request using curl
854854
curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/watch \
855-
-H 'Accept: application/json' \
855+
-H 'Accept: text/event-stream' \
856856
-H 'Coder-Session-Token: API_KEY'
857857

858858
```
@@ -869,19 +869,6 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace}/watch \
869869

870870
> 200 Response
871871
872-
```json
873-
{
874-
"detail": "string",
875-
"message": "string",
876-
"validations": [
877-
{
878-
"detail": "string",
879-
"field": "string"
880-
}
881-
]
882-
}
883-
```
884-
885872
### Responses
886873

887874
| Status | Meaning | Description | Schema |

scripts/apidocgen/markdown-template/responses.def

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33
if (!r.content) {
44
return "none";
55
}
6-
var oldRef = r.content['application/json'].schema['x-widdershins-oldRef'];
6+
var content;
7+
for (var ct in r.content) {
8+
content = r.content[ct];
9+
break;
10+
}
11+
if (!content) {
12+
return "no schema";
13+
}
14+
15+
var oldRef = content.schema["x-widdershins-oldRef"];
716
var aType = oldRef.replace("#/components/schemas/","");
817
var href = aType.replace(".","").toLowerCase();
918
return "[" + aType + "](schemas.md#" + href + ")";

0 commit comments

Comments
 (0)