Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/24648-etag-describe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@objectstack/spec': patch
---

`CompleteUploadRequestSchema.eTag` no longer describes itself as "S3 ETag verification". The upload completion door stores the client-reported value on the file record as sent and compares it with nothing, because no storage adapter reports a stored object's ETag. The description now says so, and names the check the door does run before committing: the storage backend must hold bytes under the file's key and, when the upload declared a size, hold exactly that many. The schema's shape is unchanged.
2 changes: 1 addition & 1 deletion content/docs/references/api/storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const result = CompleteChunkedUploadRequestSchema.parse(data);
| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **fileId** | `string` | ✅ | File ID returned from presigned request |
| **eTag** | `string` | optional | S3 ETag verification |
| **eTag** | `string` | optional | ETag the client reports for the uploaded object. Stored on the file record as sent and not compared with anything: no storage adapter reports a stored object's ETag. Before committing, the door checks that the storage backend holds bytes under the file's key and, when the upload declared a size, that the held size equals it. |


---
Expand Down
7 changes: 6 additions & 1 deletion packages/spec/src/api/storage.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ export const GetPresignedUrlRequestSchema = lazySchema(() => z.object({

export const CompleteUploadRequestSchema = lazySchema(() => z.object({
fileId: z.string().describe('File ID returned from presigned request'),
eTag: z.string().optional().describe('S3 ETag verification'),
eTag: z.string().optional().describe(
'ETag the client reports for the uploaded object. Stored on the file record as sent and not compared '
+ 'with anything: no storage adapter reports a stored object\'s ETag. Before committing, the door checks '
+ 'that the storage backend holds bytes under the file\'s key and, when the upload declared a size, '
+ 'that the held size equals it.',
),
}));

// ==========================================
Expand Down
Loading