Skip to content

docs: describe the Files API operations and parameters - #31550

Closed
nickvigilante wants to merge 2 commits into
mainfrom
vigilante/api-descriptions-files
Closed

nickvigilante wants to merge 2 commits into
mainfrom
vigilante/api-descriptions-files

Conversation

@nickvigilante

@nickvigilante nickvigilante commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds a description for GET /api/v2/files/{fileID} and improves its fileID parameter.
The REST API reference renders these routes from swagger.json, and they had no description.

Merge notes

This PR doesn't touch the exemption lists from #31473.
If #31473 merges first, TestEndpointsDocumented names each route on this PR to remove from those lists.

Verification

summary: need=1 problems=0 thin_params_left=0
ok  	github.com/coder/coder/v2/coderd/coderdtest	0.357s
ok  	github.com/coder/coder/v2/enterprise/coderd/coderdenttest	0.552s

A JSON diff of coderd/apidoc/swagger.json against origin/main changes only description values on the routes in this PR.

Claims checked against the code
Route Claim Evidence
GET /api/v2/files/{fileID} Readable by the uploader, the Owner role, the Template Admin role, or anyone who can update a template that uses the file; otherwise 404 coderd/database/dbauthz/dbauthz.go:4276-4290, coderd/database/modelmethods.go:691-695, coderd/rbac/roles.go:422,515
GET /api/v2/files/{fileID} format=zip converts a tar file to zip; non-tar returns 400; other format returns 400; no format returns the stored bytes with the stored Content-Type coderd/files.go:213-240
GET /api/v2/files/{fileID} fileID must be a UUID coderd/files.go:187-200
GET /api/v2/files/{fileID} Stored Content-Type is application/x-tar because zip uploads are converted to tar coderd/files.go:90-114,143
doc-check self-check

Ran in author self-check mode on the branch diff, annotation text only: Fact Checker, Continuity Editor, Copy Editor, and then the Skeptic.
The other personas didn't run because no Markdown page was written by hand, and docs/reference/api/ is generated.
Fact Checker: Found one wrong claim: the description said the file returns its original Content-Type, but POST /api/v2/files converts zip uploads to tar and stores application/x-tar (coderd/files.go:90-114,143).
Fixed in a follow-up commit.
Continuity Editor: No findings.
Copy Editor: Found one ambiguous clause: "which returns 400" could refer to the zip archive or the download.
Reworded in the same follow-up commit.
Skeptic: kept 2 and rejected 1.
One finding that organization template roles are missing from the read permission sentence, rejected because the sentence doesn't claim to be exhaustive and file reads also follow template access.
No blocking findings remain.

Writing rules applied
  • One to three present-tense, active-voice sentences, addressed to "you", with the first sentence starting with a verb.
  • Permission sentences name the built-in roles by display name, each traced to coderd/rbac/roles.go and the handler or dbauthz check.
  • Premium license, experiment, and authentication sentences appear only where the code gates the route.
  • Streams say that the route upgrades to a WebSocket and what each message carries.
  • Full API paths and exact field names, parameter names, and values are in backticks.
  • Parameter text states what the value selects, its accepted forms, and its default and limits from the code.
  • Shared parameters (user, limit, offset) use the shared wording only where the handler matches it.
  • No em dashes, en dashes, spaced double hyphens, semicolons in prose, or raw angle brackets and braces outside backticks.
CI flakes unrelated to this change

Part of DOCS-1439.

Generated by Coder Agents on behalf of @nickvigilante.

The REST API reference renders these routes from swagger.json, and they had no description.

Part of DOCS-1439.

Assisted-by: AI
@linear-code

linear-code Bot commented Oct 29, 2026

Copy link
Copy Markdown

DOCS-1439

The description said the file returns its original Content-Type, but Coder stores zip uploads as tar, so it now names the stored type, and it states which case returns 400.

Part of DOCS-1439.

Assisted-by: AI
@nickvigilante

Copy link
Copy Markdown
Collaborator Author

Combined into #31562, where this PR's changes are the commit docs: describe the Files API operations and parameters. The claims table above still covers that commit.

Generated by Coder Agents on behalf of @nickvigilante.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant