From b4be5bcfedc9c6090e8b232e3ea5c07ea72a1cca Mon Sep 17 00:00:00 2001 From: "blinkagent[bot]" <237617714+blinkagent[bot]@users.noreply.github.com> Date: Fri, 5 Dec 2025 15:27:22 +0000 Subject: [PATCH] docs: fix swagger tags for license endpoints (#21101) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Change `@Tags` from `Organizations` to `Enterprise` for `POST /licenses` and `POST /licenses/refresh-entitlements` to match the `GET` and `DELETE` license endpoints which are already tagged as `Enterprise`. ## Problem The license API endpoints were inconsistently tagged in the swagger annotations: - `GET /licenses` → `Enterprise` ✓ - `DELETE /licenses/{id}` → `Enterprise` ✓ - `POST /licenses` → `Organizations` ✗ - `POST /licenses/refresh-entitlements` → `Organizations` ✗ This caused the POST endpoints to be documented in the [Organizations API docs](https://coder.com/docs/reference/api/organizations) instead of the [Enterprise API docs](https://coder.com/docs/reference/api/enterprise) where the other license endpoints live. ## Fix Simply updated the `@Tags` annotation from `Organizations` to `Enterprise` for both POST endpoints. This was an oversight from the original swagger docs addition in #5625 (January 2023). Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com> --- coderd/apidoc/docs.go | 4 +- coderd/apidoc/swagger.json | 4 +- docs/reference/api/enterprise.md | 87 +++++++++++++++++++++++++++++ docs/reference/api/organizations.md | 87 ----------------------------- enterprise/coderd/licenses.go | 4 +- 5 files changed, 93 insertions(+), 93 deletions(-) diff --git a/coderd/apidoc/docs.go b/coderd/apidoc/docs.go index 796852563f..a72269bb5e 100644 --- a/coderd/apidoc/docs.go +++ b/coderd/apidoc/docs.go @@ -1800,7 +1800,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Organizations" + "Enterprise" ], "summary": "Add new license", "operationId": "add-new-license", @@ -1836,7 +1836,7 @@ const docTemplate = `{ "application/json" ], "tags": [ - "Organizations" + "Enterprise" ], "summary": "Update license entitlements", "operationId": "update-license-entitlements", diff --git a/coderd/apidoc/swagger.json b/coderd/apidoc/swagger.json index 56b13cfa9c..cd60b4bf9c 100644 --- a/coderd/apidoc/swagger.json +++ b/coderd/apidoc/swagger.json @@ -1570,7 +1570,7 @@ ], "consumes": ["application/json"], "produces": ["application/json"], - "tags": ["Organizations"], + "tags": ["Enterprise"], "summary": "Add new license", "operationId": "add-new-license", "parameters": [ @@ -1602,7 +1602,7 @@ } ], "produces": ["application/json"], - "tags": ["Organizations"], + "tags": ["Enterprise"], "summary": "Update license entitlements", "operationId": "update-license-entitlements", "responses": { diff --git a/docs/reference/api/enterprise.md b/docs/reference/api/enterprise.md index dfdeeb1756..0f39e4e305 100644 --- a/docs/reference/api/enterprise.md +++ b/docs/reference/api/enterprise.md @@ -727,6 +727,93 @@ Status Code **200** To perform this operation, you must be authenticated. [Learn more](authentication.md). +## Add new license + +### Code samples + +```shell +# Example request using curl +curl -X POST http://coder-server:8080/api/v2/licenses \ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`POST /licenses` + +> Body parameter + +```json +{ + "license": "string" +} +``` + +### Parameters + +| Name | In | Type | Required | Description | +|--------|------|--------------------------------------------------------------------|----------|---------------------| +| `body` | body | [codersdk.AddLicenseRequest](schemas.md#codersdkaddlicenserequest) | true | Add license request | + +### Example responses + +> 201 Response + +```json +{ + "claims": {}, + "id": 0, + "uploaded_at": "2019-08-24T14:15:22Z", + "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f" +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +|--------|--------------------------------------------------------------|-------------|------------------------------------------------| +| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.License](schemas.md#codersdklicense) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + +## Update license entitlements + +### Code samples + +```shell +# Example request using curl +curl -X POST http://coder-server:8080/api/v2/licenses/refresh-entitlements \ + -H 'Accept: application/json' \ + -H 'Coder-Session-Token: API_KEY' +``` + +`POST /licenses/refresh-entitlements` + +### Example responses + +> 201 Response + +```json +{ + "detail": "string", + "message": "string", + "validations": [ + { + "detail": "string", + "field": "string" + } + ] +} +``` + +### Responses + +| Status | Meaning | Description | Schema | +|--------|--------------------------------------------------------------|-------------|--------------------------------------------------| +| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.Response](schemas.md#codersdkresponse) | + +To perform this operation, you must be authenticated. [Learn more](authentication.md). + ## Delete license ### Code samples diff --git a/docs/reference/api/organizations.md b/docs/reference/api/organizations.md index ffd6f78405..36fdab0208 100644 --- a/docs/reference/api/organizations.md +++ b/docs/reference/api/organizations.md @@ -1,92 +1,5 @@ # Organizations -## Add new license - -### Code samples - -```shell -# Example request using curl -curl -X POST http://coder-server:8080/api/v2/licenses \ - -H 'Content-Type: application/json' \ - -H 'Accept: application/json' \ - -H 'Coder-Session-Token: API_KEY' -``` - -`POST /licenses` - -> Body parameter - -```json -{ - "license": "string" -} -``` - -### Parameters - -| Name | In | Type | Required | Description | -|--------|------|--------------------------------------------------------------------|----------|---------------------| -| `body` | body | [codersdk.AddLicenseRequest](schemas.md#codersdkaddlicenserequest) | true | Add license request | - -### Example responses - -> 201 Response - -```json -{ - "claims": {}, - "id": 0, - "uploaded_at": "2019-08-24T14:15:22Z", - "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f" -} -``` - -### Responses - -| Status | Meaning | Description | Schema | -|--------|--------------------------------------------------------------|-------------|------------------------------------------------| -| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.License](schemas.md#codersdklicense) | - -To perform this operation, you must be authenticated. [Learn more](authentication.md). - -## Update license entitlements - -### Code samples - -```shell -# Example request using curl -curl -X POST http://coder-server:8080/api/v2/licenses/refresh-entitlements \ - -H 'Accept: application/json' \ - -H 'Coder-Session-Token: API_KEY' -``` - -`POST /licenses/refresh-entitlements` - -### Example responses - -> 201 Response - -```json -{ - "detail": "string", - "message": "string", - "validations": [ - { - "detail": "string", - "field": "string" - } - ] -} -``` - -### Responses - -| Status | Meaning | Description | Schema | -|--------|--------------------------------------------------------------|-------------|--------------------------------------------------| -| 201 | [Created](https://tools.ietf.org/html/rfc7231#section-6.3.2) | Created | [codersdk.Response](schemas.md#codersdkresponse) | - -To perform this operation, you must be authenticated. [Learn more](authentication.md). - ## Get organizations ### Code samples diff --git a/enterprise/coderd/licenses.go b/enterprise/coderd/licenses.go index 8e71388655..e46b6791cd 100644 --- a/enterprise/coderd/licenses.go +++ b/enterprise/coderd/licenses.go @@ -59,7 +59,7 @@ var Keys = map[string]ed25519.PublicKey{"2022-08-12": ed25519.PublicKey(key20220 // @Security CoderSessionToken // @Accept json // @Produce json -// @Tags Organizations +// @Tags Enterprise // @Param request body codersdk.AddLicenseRequest true "Add license request" // @Success 201 {object} codersdk.License // @Router /licenses [post] @@ -163,7 +163,7 @@ func (api *API) postLicense(rw http.ResponseWriter, r *http.Request) { // @ID update-license-entitlements // @Security CoderSessionToken // @Produce json -// @Tags Organizations +// @Tags Enterprise // @Success 201 {object} codersdk.Response // @Router /licenses/refresh-entitlements [post] func (api *API) postRefreshEntitlements(rw http.ResponseWriter, r *http.Request) {