Skip to content

Conversation

@blinkagent
Copy link
Contributor

@blinkagent blinkagent bot commented Dec 2, 2025

Fixes #21070

Description

The POST /api/v2/files endpoint returns 200 OK when a file with the same hash already exists (idempotent upload behavior), but the API documentation only documented the 201 Created response.

This PR updates the Swagger annotations to document both response codes:

  • 200 OK - Returns existing file if duplicate
  • 201 Created - Returns newly created file

Changes

  • Updated coderd/files.go to include both success response codes in the Swagger annotation

Copy link
Contributor

@cstyan cstyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had a quick look at the related function and this docs update appears to be correct AFAICT

@david-fraley david-fraley merged commit 50d42ab into main Dec 8, 2025
32 checks passed
@david-fraley david-fraley deleted the fix/docs-upload-file-200-response branch December 8, 2025 22:04
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2025
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.

docs: Upload file API can return 200 OK when file already exists, not just 201 Created

3 participants