From ea174d3f120bf43c0219eb341e9373834036083c Mon Sep 17 00:00:00 2001 From: Matt Miller Date: Wed, 20 May 2026 21:28:16 -0700 Subject: [PATCH] fix(openapi): correct POST /api/assets/import to importPublishedAssets (#14027) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The operation at POST /api/assets/import was defined as `importAssets` with a URL-list body shape, but no runtime actually serves that operation at this path. The cloud runtime serves a different operation here — `importPublishedAssets` — which imports published-workflow assets into the caller's library by ID, not by URL. Cloud's URL-based asset ingestion lives at separate paths (POST /assets/download + GET /assets/remote-metadata) tracked elsewhere; nothing in this PR affects that work. Changes: - Replace the operation at POST /api/assets/import with `importPublishedAssets`, taking ImportPublishedAssetsRequest (published_asset_ids + optional share_id) and returning ImportPublishedAssetsResponse (list of AssetInfo). - Remove the unused AssetImportRequest component schema (no other references in the spec). - Operation and schemas tagged x-runtime: [cloud] with [cloud-only] description prefix, matching the existing convention for cloud-runtime-only operations elsewhere in the spec. Spectral lint passes (0 errors); the two hint-level findings on the spec are pre-existing and unrelated. No FE consumer references AssetImportRequest today; this is a pure spec correction to match what the cloud runtime actually serves. --- openapi.yaml | 59 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 92f7eaccc..0e7a9b4a7 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2514,37 +2514,25 @@ paths: /api/assets/import: post: - operationId: importAssets + operationId: importPublishedAssets tags: [assets] - summary: Import assets from external URLs - description: "[cloud-only] Imports one or more assets from external URLs into the cloud asset store." + summary: "[cloud-only] Import published assets into the caller's library" + description: | + [cloud-only] Imports the specified published assets into the caller's asset library. New DB records reference the same storage objects; no file copying occurs. Assets the caller already owns (by hash) are deduplicated. The `id` field on each returned `AssetInfo` is the caller's newly-created private asset ID, not the published asset ID supplied in the request. x-runtime: [cloud] requestBody: required: true content: application/json: schema: - type: object - required: - - imports - properties: - imports: - type: array - items: - $ref: "#/components/schemas/AssetImportRequest" - description: Assets to import + $ref: "#/components/schemas/ImportPublishedAssetsRequest" responses: "200": - description: Import initiated + description: Successfully imported assets content: application/json: schema: - type: object - properties: - assets: - type: array - items: - $ref: "#/components/schemas/Asset" + $ref: "#/components/schemas/ImportPublishedAssetsResponse" "400": description: Bad request content: @@ -7379,24 +7367,35 @@ components: type: string description: Target path on the runtime filesystem - AssetImportRequest: + ImportPublishedAssetsRequest: type: object x-runtime: [cloud] - description: "[cloud-only] A single asset to import from an external URL." + description: "[cloud-only] Request body for importing published assets into the caller's library." required: - - url + - published_asset_ids properties: - url: - type: string - format: uri - description: URL of the asset to import - name: - type: string - description: Display name for the imported asset - tags: + published_asset_ids: type: array + description: IDs of published assets (inputs and models) to import. items: type: string + share_id: + type: string + nullable: true + description: | + Optional. Share ID of the published workflow these assets belong to. When provided (non-null, non-empty): all `published_asset_ids` must belong to this share's workflow version; returns 400 if the share is not found or any asset does not belong to it. When omitted, null, or empty string: no share-scoped validation is performed and the assets are validated only against global rules (preserved for clients that have not yet adopted `share_id`). + + ImportPublishedAssetsResponse: + type: object + x-runtime: [cloud] + description: "[cloud-only] Response after importing published assets. Each returned `AssetInfo.id` is the caller's newly-created private asset ID, not the published asset ID supplied in the request." + required: + - assets + properties: + assets: + type: array + items: + $ref: "#/components/schemas/AssetInfo" RemoteAssetMetadata: type: object