Changelog - 2026-11-11
Direct upload can validate a file before it is committed
New FeatureIn one line. Set directUpload.validation and the component adds POST {base}/upload-validate, which answers the problems your own check finds, while commit refuses a file that fails it.
What changed
directUpload.validation. Build it withStaticAssetValidation.define({ issueSchema, handler }).issueSchemais the shape of one issue, in your own terms (for an Excel import: sheet, row, column, code, message). The handler gets the pending object, the storage helper and the owner, and answers{ isValid, issues }; an issue of another shape fails type-checking.POST {base}/upload-validate. Registered only whenvalidationis set, overridable and disableable throughroutes.uploadValidate. It takes{ commitToken }, callsauthorizefirst, resolves the owner and answers your issues in your shape.- Commit validates first.
commitruns the same check and refuses an invalid file with422core.static_asset.upload_invalid, beforeonCommitand before any copy. validate({ token, owner? })onStaticAssetUploadCommitServiceis the same check from a service. With novalidationconfigured it answers{ isValid: true, issues: [] }.- New error.
core.static_asset.upload_invalid,422.
Who is affected
- Apps that wrote their own validate route. Replace it with
validation; the component owns the route, the authorization and the refusal. - Everyone else. No action needed: with no
validation, nothing changes.
Details
typescript
const workbookValidation = StaticAssetValidation.define({
issueSchema: z.object({ sheet: z.string(), row: z.number().int(), message: z.string() }),
handler: async ({ bucket, object, owner, helper }) => {
const issues = await checkWorkbook({ stream: await helper.getObject({ bucket, object }), owner });
return { isValid: issues.length === 0, issues };
},
});See Direct upload for the full flow.