From 12bdbc693ffb8d345fbdc7aeec32eefb31b2b8ba Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Tue, 10 Mar 2026 15:04:08 +0000 Subject: [PATCH] docs: remove experimental chat API from generated docs (#22897) The chat API is experimental (behind `ExperimentAgents`) and not ready for public documentation yet. This removes swagger annotations from the chat handlers so they no longer appear in the generated API reference at https://coder.com/docs/reference/api/chats. ## Changes - Remove `@swagger` annotations from 5 chat handlers in `coderd/chats.go` - Regenerate `coderd/apidoc/swagger.json` and `docs.go` - Delete `docs/reference/api/chats.md` - Remove Chats entry from `docs/manifest.json` --- coderd/apidoc/docs.go | 188 ---------------------------------- coderd/apidoc/swagger.json | 174 ------------------------------- coderd/chats.go | 43 -------- docs/manifest.json | 4 - docs/reference/api/chats.md | 141 ------------------------- docs/reference/api/schemas.md | 14 --- 6 files changed, 564 deletions(-) delete mode 100644 docs/reference/api/chats.md diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 09f8a5e26d..f47c449057 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -481,185 +481,6 @@ const docTemplate = `{ } } }, - "/chats/files": { - "post": { - "security": [ - { - "CoderSessionToken": [] - } - ], - "consumes": [ - "application/octet-stream" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Chats" - ], - "summary": "Upload a chat file", - "operationId": "upload-chat-file", - "parameters": [ - { - "type": "string", - "description": "Content-Type must be an image type (image/png, image/jpeg, image/gif, image/webp)", - "name": "Content-Type", - "in": "header", - "required": true - }, - { - "type": "string", - "format": "uuid", - "description": "Organization ID", - "name": "organization", - "in": "query", - "required": true - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/codersdk.UploadChatFileResponse" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "413": { - "description": "Request Entity Too Large", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - } - } - } - }, - "/chats/files/{file}": { - "get": { - "security": [ - { - "CoderSessionToken": [] - } - ], - "tags": [ - "Chats" - ], - "summary": "Get a chat file", - "operationId": "get-chat-file", - "parameters": [ - { - "type": "string", - "format": "uuid", - "description": "File ID", - "name": "file", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - } - } - } - }, - "/chats/{chat}/archive": { - "post": { - "tags": [ - "Chats" - ], - "summary": "Archive a chat", - "operationId": "archive-chat", - "responses": { - "204": { - "description": "No Content" - } - } - } - }, - "/chats/{chat}/git/watch": { - "get": { - "security": [ - { - "CoderSessionToken": [] - } - ], - "tags": [ - "Chats" - ], - "summary": "Watch git changes for a chat.", - "operationId": "watch-chat-git", - "parameters": [ - { - "type": "string", - "format": "uuid", - "description": "Chat ID", - "name": "chat", - "in": "path", - "required": true - } - ], - "responses": { - "101": { - "description": "Switching Protocols" - } - } - } - }, - "/chats/{chat}/unarchive": { - "post": { - "tags": [ - "Chats" - ], - "summary": "Unarchive a chat", - "operationId": "unarchive-chat", - "responses": { - "204": { - "description": "No Content" - } - } - } - }, "/connectionlog": { "get": { "security": [ @@ -20456,15 +20277,6 @@ const docTemplate = `{ } } }, - "codersdk.UploadChatFileResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" - } - } - }, "codersdk.UploadResponse": { "type": "object", "properties": { diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index a234b00b51..bc1b58c27b 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -410,171 +410,6 @@ } } }, - "/chats/files": { - "post": { - "security": [ - { - "CoderSessionToken": [] - } - ], - "consumes": ["application/octet-stream"], - "produces": ["application/json"], - "tags": ["Chats"], - "summary": "Upload a chat file", - "operationId": "upload-chat-file", - "parameters": [ - { - "type": "string", - "description": "Content-Type must be an image type (image/png, image/jpeg, image/gif, image/webp)", - "name": "Content-Type", - "in": "header", - "required": true - }, - { - "type": "string", - "format": "uuid", - "description": "Organization ID", - "name": "organization", - "in": "query", - "required": true - } - ], - "responses": { - "201": { - "description": "Created", - "schema": { - "$ref": "#/definitions/codersdk.UploadChatFileResponse" - } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "413": { - "description": "Request Entity Too Large", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - } - } - } - }, - "/chats/files/{file}": { - "get": { - "security": [ - { - "CoderSessionToken": [] - } - ], - "tags": ["Chats"], - "summary": "Get a chat file", - "operationId": "get-chat-file", - "parameters": [ - { - "type": "string", - "format": "uuid", - "description": "File ID", - "name": "file", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/codersdk.Response" - } - } - } - } - }, - "/chats/{chat}/archive": { - "post": { - "tags": ["Chats"], - "summary": "Archive a chat", - "operationId": "archive-chat", - "responses": { - "204": { - "description": "No Content" - } - } - } - }, - "/chats/{chat}/git/watch": { - "get": { - "security": [ - { - "CoderSessionToken": [] - } - ], - "tags": ["Chats"], - "summary": "Watch git changes for a chat.", - "operationId": "watch-chat-git", - "parameters": [ - { - "type": "string", - "format": "uuid", - "description": "Chat ID", - "name": "chat", - "in": "path", - "required": true - } - ], - "responses": { - "101": { - "description": "Switching Protocols" - } - } - } - }, - "/chats/{chat}/unarchive": { - "post": { - "tags": ["Chats"], - "summary": "Unarchive a chat", - "operationId": "unarchive-chat", - "responses": { - "204": { - "description": "No Content" - } - } - } - }, "/connectionlog": { "get": { "security": [ @@ -18764,15 +18599,6 @@ } } }, - "codersdk.UploadChatFileResponse": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" - } - } - }, "codersdk.UploadResponse": { "type": "object", "properties": { diff --git a/coderd/chats.go b/coderd/chats.go index 622ae35469..d3e4a557c1 100644 --- a/coderd/chats.go +++ b/coderd/chats.go @@ -432,14 +432,6 @@ func (api *API) getChat(rw http.ResponseWriter, r *http.Request) { }) } -// @Summary Watch git changes for a chat. -// @ID watch-chat-git -// @Security CoderSessionToken -// @Tags Chats -// @Param chat path string true "Chat ID" format(uuid) -// @Success 101 -// @Router /chats/{chat}/git/watch [get] -// // EXPERIMENTAL: this endpoint is experimental and is subject to change. // //nolint:revive // HTTP handler writes to ResponseWriter. @@ -588,11 +580,6 @@ proxyLoop: _ = clientStream.Close(websocket.StatusGoingAway) } -// @Summary Archive a chat -// @ID archive-chat -// @Tags Chats -// @Success 204 -// @Router /chats/{chat}/archive [post] func (api *API) archiveChat(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() chat := httpmw.ChatParam(r) @@ -624,11 +611,6 @@ func (api *API) archiveChat(rw http.ResponseWriter, r *http.Request) { rw.WriteHeader(http.StatusNoContent) } -// @Summary Unarchive a chat -// @ID unarchive-chat -// @Tags Chats -// @Success 204 -// @Router /chats/{chat}/unarchive [post] func (api *API) unarchiveChat(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() chat := httpmw.ChatParam(r) @@ -2333,20 +2315,6 @@ func (api *API) resolvedChatSystemPrompt(ctx context.Context) string { return chatd.DefaultSystemPrompt } -// @Summary Upload a chat file -// @ID upload-chat-file -// @Security CoderSessionToken -// @Accept application/octet-stream -// @Produce json -// @Tags Chats -// @Param Content-Type header string true "Content-Type must be an image type (image/png, image/jpeg, image/gif, image/webp)" -// @Param organization query string true "Organization ID" format(uuid) -// @Success 201 {object} codersdk.UploadChatFileResponse -// @Failure 400 {object} codersdk.Response -// @Failure 401 {object} codersdk.Response -// @Failure 413 {object} codersdk.Response -// @Failure 500 {object} codersdk.Response -// @Router /chats/files [post] func (api *API) postChatFile(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() apiKey := httpmw.APIKey(r) @@ -2473,17 +2441,6 @@ func (api *API) postChatFile(rw http.ResponseWriter, r *http.Request) { }) } -// @Summary Get a chat file -// @ID get-chat-file -// @Security CoderSessionToken -// @Tags Chats -// @Param file path string true "File ID" format(uuid) -// @Success 200 -// @Failure 400 {object} codersdk.Response -// @Failure 401 {object} codersdk.Response -// @Failure 404 {object} codersdk.Response -// @Failure 500 {object} codersdk.Response -// @Router /chats/files/{file} [get] func (api *API) chatFileByID(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() diff --git a/docs/manifest.json b/docs/manifest.json index 6f4085070d..0f0e6b2798 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1406,10 +1406,6 @@ "title": "Builds", "path": "./reference/api/builds.md" }, - { - "title": "Chats", - "path": "./reference/api/chats.md" - }, { "title": "Debug", "path": "./reference/api/debug.md" diff --git a/docs/reference/api/chats.md b/docs/reference/api/chats.md deleted file mode 100644 index 073b509a08..0000000000 --- a/docs/reference/api/chats.md +++ /dev/null @@ -1,141 +0,0 @@ -# Chats - -## Upload a chat file - -### Code samples - -```shell -# Example request using curl -curl -X POST http://coder-server:8080/api/v2/chats/files?organization=497f6eca-6276-4993-bfeb-53cbbbba6f08 \ - -H 'Accept: application/json' \ - -H 'Content-Type: string' \ - -H 'Coder-Session-Token: API_KEY' -``` - -`POST /chats/files` - -### Parameters - -| Name | In | Type | Required | Description | -|----------------|--------|--------------|----------|-----------------------------------------------------------------------------------| -| `Content-Type` | header | string | true | Content-Type must be an image type (image/png, image/jpeg, image/gif, image/webp) | -| `organization` | query | string(uuid) | true | Organization ID | - -### Example responses - -> 201 Response - -```json -{ - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" -} -``` - -### Responses - -| Status | Meaning | Description | Schema | -|--------|----------------------------------------------------------------------------|--------------------------|------------------------------------------------------------------------------| -| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.UploadChatFileResponse](schemas.md#codersdkuploadchatfileresponse) | -| 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Bad Request | [codersdk.Response](schemas.md#codersdkresponse) | -| 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | Unauthorized | [codersdk.Response](schemas.md#codersdkresponse) | -| 413 | [Payload Too Large](https://tools.ietf.org/html/rfc7231#section-6.5.11) | Request Entity Too Large | [codersdk.Response](schemas.md#codersdkresponse) | -| 500 | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Internal Server Error | [codersdk.Response](schemas.md#codersdkresponse) | - -To perform this operation, you must be authenticated. [Learn more](authentication.md). - -## Get a chat file - -### Code samples - -```shell -# Example request using curl -curl -X GET http://coder-server:8080/api/v2/chats/files/{file} \ - -H 'Accept: */*' \ - -H 'Coder-Session-Token: API_KEY' -``` - -`GET /chats/files/{file}` - -### Parameters - -| Name | In | Type | Required | Description | -|--------|------|--------------|----------|-------------| -| `file` | path | string(uuid) | true | File ID | - -### Example responses - -> 400 Response - -### Responses - -| Status | Meaning | Description | Schema | -|--------|----------------------------------------------------------------------------|-----------------------|--------------------------------------------------| -| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | | -| 400 | [Bad Request](https://tools.ietf.org/html/rfc7231#section-6.5.1) | Bad Request | [codersdk.Response](schemas.md#codersdkresponse) | -| 401 | [Unauthorized](https://tools.ietf.org/html/rfc7235#section-3.1) | Unauthorized | [codersdk.Response](schemas.md#codersdkresponse) | -| 404 | [Not Found](https://tools.ietf.org/html/rfc7231#section-6.5.4) | Not Found | [codersdk.Response](schemas.md#codersdkresponse) | -| 500 | [Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1) | Internal Server Error | [codersdk.Response](schemas.md#codersdkresponse) | - -To perform this operation, you must be authenticated. [Learn more](authentication.md). - -## Archive a chat - -### Code samples - -```shell -# Example request using curl -curl -X POST http://coder-server:8080/api/v2/chats/{chat}/archive - -``` - -`POST /chats/{chat}/archive` - -### Responses - -| Status | Meaning | Description | Schema | -|--------|-----------------------------------------------------------------|-------------|--------| -| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | | - -## Watch git changes for a chat - -### Code samples - -```shell -# Example request using curl -curl -X GET http://coder-server:8080/api/v2/chats/{chat}/git/watch \ - -H 'Coder-Session-Token: API_KEY' -``` - -`GET /chats/{chat}/git/watch` - -### Parameters - -| Name | In | Type | Required | Description | -|--------|------|--------------|----------|-------------| -| `chat` | path | string(uuid) | true | Chat ID | - -### Responses - -| Status | Meaning | Description | Schema | -|--------|--------------------------------------------------------------------------|---------------------|--------| -| 101 | [Switching Protocols](https://tools.ietf.org/html/rfc7231#section-6.2.2) | Switching Protocols | | - -To perform this operation, you must be authenticated. [Learn more](authentication.md). - -## Unarchive a chat - -### Code samples - -```shell -# Example request using curl -curl -X POST http://coder-server:8080/api/v2/chats/{chat}/unarchive - -``` - -`POST /chats/{chat}/unarchive` - -### Responses - -| Status | Meaning | Description | Schema | -|--------|-----------------------------------------------------------------|-------------|--------| -| 204 | [No Content](https://tools.ietf.org/html/rfc7231#section-6.3.5) | No Content | | diff --git a/docs/reference/api/schemas.md b/docs/reference/api/schemas.md index c113917502..cd67ea783d 100644 --- a/docs/reference/api/schemas.md +++ b/docs/reference/api/schemas.md @@ -9847,20 +9847,6 @@ If the schedule is empty, the user will be updated to use the default schedule.| |----------|---------|----------|--------------|-------------| | `ttl_ms` | integer | false | | | -## codersdk.UploadChatFileResponse - -```json -{ - "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08" -} -``` - -### Properties - -| Name | Type | Required | Restrictions | Description | -|------|--------|----------|--------------|-------------| -| `id` | string | false | | | - ## codersdk.UploadResponse ```json