From f2bf04fd4209dfc687bac0098b0d5c3ec2799327 Mon Sep 17 00:00:00 2001 From: Riyadh Date: Wed, 20 May 2026 09:30:21 +0000 Subject: [PATCH] Allow relative URLs for upload destinations in API responses Update OpenAPI spec and generated schemas to permit relative paths for upload URLs, resolving validation errors with the local storage driver. --- lib/api-client-react/src/generated/api.schemas.ts | 5 +++++ lib/api-spec/openapi.yaml | 8 +++++++- lib/api-zod/src/generated/api.ts | 7 ++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/api-client-react/src/generated/api.schemas.ts b/lib/api-client-react/src/generated/api.schemas.ts index d1dc49fb..e34b53c2 100644 --- a/lib/api-client-react/src/generated/api.schemas.ts +++ b/lib/api-client-react/src/generated/api.schemas.ts @@ -802,6 +802,11 @@ export interface RequestUploadUrlBody { } export interface RequestUploadUrlResponse { + /** + * Presigned upload destination. May be either an absolute URL (S3 driver) or a same-origin path starting with `/` (local driver) — the browser resolves the latter against `window.location.origin` so uploads always target the host serving the SPA. + + * @minLength 1 + */ uploadURL: string; objectPath: string; metadata?: RequestUploadUrlBody; diff --git a/lib/api-spec/openapi.yaml b/lib/api-spec/openapi.yaml index 9c1a4de9..0ab1b7c1 100644 --- a/lib/api-spec/openapi.yaml +++ b/lib/api-spec/openapi.yaml @@ -4283,7 +4283,13 @@ components: properties: uploadURL: type: string - format: uri + minLength: 1 + description: > + Presigned upload destination. May be either an absolute URL + (S3 driver) or a same-origin path starting with `/` (local + driver) — the browser resolves the latter against + `window.location.origin` so uploads always target the host + serving the SPA. objectPath: type: string metadata: diff --git a/lib/api-zod/src/generated/api.ts b/lib/api-zod/src/generated/api.ts index e84bd146..ceb34993 100644 --- a/lib/api-zod/src/generated/api.ts +++ b/lib/api-zod/src/generated/api.ts @@ -1061,7 +1061,12 @@ export const RequestUploadUrlBody = zod.object({ }); export const RequestUploadUrlResponse = zod.object({ - uploadURL: zod.string().url(), + uploadURL: zod + .string() + .min(1) + .describe( + "Presigned upload destination. May be either an absolute URL (S3 driver) or a same-origin path starting with `\/` (local driver) — the browser resolves the latter against `window.location.origin` so uploads always target the host serving the SPA.\n", + ), objectPath: zod.string(), metadata: zod .object({