Repository navigation
docs: describe the Users API operations and parameters - #31528
Closed
nickvigilante wants to merge 1 commit into
Closed
nickvigilante wants to merge 1 commit into
nickvigilante wants to merge 1 commit into
Conversation
The REST API reference renders these routes from swagger.json, and they had no description. This adds a description to each of the 34 Users routes and rewrites the thin or non-standard parameter text on them. Part of DOCS-1439. Assisted-by: AI
Collaborator
Author
|
Combined into #31562, where this PR's changes are the commit Generated by Coder Agents on behalf of @nickvigilante. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The REST API reference renders each route from
swagger.json, and the 34 Users routes had no description.This adds a
@Descriptionto each of them and rewrites the parameter text on them, so each endpoint page says what the call does, who can call it, and what to know before calling it.Merge notes
This PR doesn't touch #31473's exemption lists.
If #31473 merges first,
TestEndpointsDocumentednames each route on this PR to remove from those lists.Verification
A JSON diff of
swagger.jsonagainstmainchanges onlydescriptionvalues: 34 added to operations and 42 rewritten on parameters, all on the 34 routes in scope.Claims checked against the code
Role grants come from
coderd/rbac/roles.go: Owner has all permissions (:414), Auditor reads users (:488), Template Admin reads users (:521), User Admin has create, read, update, delete, and personal read and update on users (:539), Organization Admin and Organization User Admin read users site-wide (:594,:650), and Member reads and updates only its own personal data (:463).GET /api/v2/userscoderd/database/dbauthz/dbauthz.go:5778GET /api/v2/usersqkeys, and a bare term matches email, username, or namecoderd/searchquery/search.go:206,coderd/database/queries/users.sql:447GET /api/v2/userslimitdefaults to0(all results),after_idandoffsetpage resultscoderd/pagination.go:19,coderd/users.go:396,coderd/users.go:417POST /api/v2/userscoderd/database/dbauthz/dbauthz.go:6939,coderd/rbac/roles.go:539POST /api/v2/userscoderd/users.go:503POST /api/v2/usersorganization_idsneeds at least one organization, service accounts can't have an email or passwordcoderd/users.go:537,coderd/users.go:471GET /api/v2/users/authmethodscoderd/coderd.go:1702, router group withoutapiKeyMiddlewareGET /api/v2/users/first200or404by user count, no session tokencoderd/users.go:160,coderd/coderd.go:1700POST /api/v2/users/first409once a user exists, no session tokencoderd/users.go:207,coderd/users.go:270,coderd/coderd.go:1701POST /api/v2/users/logoutcoderd/userauth.go:710,coderd/userauth.go:718,coderd/userauth.go:732GET /api/v2/users/oauth2/github/callbackredirect_urlJSON when device flow is oncoderd/coderd.go:1722,coderd/userauth.go:1153GET /api/v2/users/oauth2/github/devicedevice_code,user_code,verification_uricoderd/userauth.go:857,coderd/userauth.go:864,codersdk/externalauth.go:123GET /api/v2/users/oidc-claims400unless the login type isoidc, userinfo claims win on conflictcoderd/users.go:102,codersdk/users.go:451GET /api/v2/users/oidc/callbackcoderd/coderd.go:1729,coderd/userauth.go:1590GET /api/v2/users/{user}coderd/database/dbauthz/dbauthz.go:5580,coderd/rbac/roles.go:488,:521,:539,:594,:650DELETE /api/v2/users/{user}coderd/database/dbauthz/dbauthz.go:8884,coderd/users.go:703,coderd/users.go:723DELETE /api/v2/users/{user}coderd/users.go:743GET,PUT /api/v2/users/{user}/appearancecoderd/database/dbauthz/dbauthz.go:5565,:9108,:9064,coderd/rbac/roles.go:463,:539PUT /api/v2/users/{user}/appearancetheme_modekeeps the saved mode and themes,synctakes light and dark themescoderd/users.go:1351,codersdk/users.go:268GET,PUT /api/v2/users/{user}/preferencescoderd/database/dbauthz/dbauthz.go:5767,coderd/users.go:1528,coderd/users.go:1570,codersdk/users.go:298GET,PUT /api/v2/users/{user}/gitsshkeycoderd/database/dbauthz/dbauthz.go:4307,:8275,coderd/gitsshkey.go:80POST /api/v2/users/{user}/keyscoderd/database/dbauthz/dbauthz.go:6454,coderd/apikey/apikey.go:179GET /api/v2/users/{user}/keys/tokensinclude_expireddefaults tofalsecoderd/apikey.go:384,coderd/apikey.go:355GET /api/v2/users/{user}/keys/tokensinclude_alllists tokens for every user you can readcoderd/apikey.go:354POST /api/v2/users/{user}/keys/tokenscoderd/apikey.go:129,coderd/apikey.go:597,codersdk/deployment.go:3513,:3527,:3538POST /api/v2/users/{user}/keys/tokensscopesdefault to the calling key's scopes, a name is generated whentoken_nameis omitted,lifetimeis nanosecondscoderd/apikey/apikey.go:183,coderd/apikey.go:120,codersdk/apikey.go:50GET /api/v2/users/{user}/keys/tokens/{keyname}coderd/database/dbauthz/dbauthz.go:3177,coderd/database/modelmethods.go:430GET,DELETE,PUT /api/v2/users/{user}/keys/{keyid},/expirecoderd/database/dbauthz/dbauthz.go:3173,:2219,:7870,coderd/database/modelmethods.go:430PUT /api/v2/users/{user}/keys/{keyid}/expirecoderd/apikey.go:500GET /api/v2/users/{user}/keys/{keyid}coderd/apikey/apikey.go:54,coderd/apikey/apikey.go:102GET /api/v2/users/{user}/login-typecoderd/users.go:836GET /api/v2/users/{user}/organizationscoderd/users.go:2056GET /api/v2/users/{user}/organizations/{organizationname}coderd/users.go:2083PUT /api/v2/users/{user}/passwordcoderd/users.go:1876PUT /api/v2/users/{user}/passwordold_passwordfor yourself, password login type onlycoderd/users.go:1768,:1773,:1797,:1805PUT /api/v2/users/{user}/profilecoderd/users.go:1031PUT /api/v2/users/{user}/profilepasswordandnonelogin typescoderd/users.go:1065GET /api/v2/users/{user}/rolescoderd/users.go:1912PUT /api/v2/users/{user}/rolescoderd/database/dbauthz/dbauthz.go:1431,coderd/rbac/roles.go:827PUT /api/v2/users/{user}/rolescoderd/users.go:1984,coderd/users.go:1974PUT /api/v2/users/{user}/status/activatecoderd/database/dbauthz/dbauthz.go:9057PUT /api/v2/users/{user}/status/suspendcoderd/database/dbauthz/dbauthz.go:9057,coderd/users.go:1154,coderd/users.go:1158PUT /api/v2/users/{user}/status/suspendcoderd/userauth.go:632Identifiers left out of the text, per the content guidelines: the CLI flags for the default and maximum token lifetime (
--default-token-lifetime,--max-token-lifetime,--max-admin-token-lifetime) incodersdk/deployment.go.Writing rules applied
dbauthzandroles.go.userparameter wording is copied exactly on every route behindExtractUserParam.limit,offset, andafter_iduse the shared pagination wording becauseParsePaginationis the only source of defaults.Annotation issues noticed and not changed
These are outside this PR's scope.
GET /api/v2/users/first,POST /api/v2/users/first,GET /api/v2/users/authmethods,GET /api/v2/users/oauth2/github/callback,GET /api/v2/users/oauth2/github/device, andGET /api/v2/users/oidc/callbackhave@Security CoderSessionToken, but the router serves them withoutapiKeyMiddleware(coderd/coderd.go:1699).assertSecurityDefineddoesn't list them.GET /api/v2/users/{user}/keys/tokensreads aninclude_allquery parameter (coderd/apikey.go:354) that has no@Param.GET /api/v2/users/oauth2/github/callbackdocuments only307, but it returns200withredirect_urlwhen device flow is on (coderd/userauth.go:1153).GET /api/v2/users/{user}/keys/{keyid},DELETE, andPUT .../expirelook the key up by ID alone, so theuserpath segment doesn't scope the lookup.GET /api/v2/users/{user}/organizations/{organizationname}doesn't useuserafter resolving it.POST /api/v2/usersdocumentscodersdk.CreateUserRequestwhile the handler readsCreateUserRequestWithOrgs, an alias with the same fields.Part of DOCS-1439.
Generated by Coder Agents on behalf of @nickvigilante.