mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-25 16:37:23 +08:00
fix(openapi): correct POST /api/assets/import to importPublishedAssets (#14027)
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.
This commit is contained in:
parent
9f9b32ed97
commit
ea174d3f12
59
openapi.yaml
59
openapi.yaml
@ -2514,37 +2514,25 @@ paths:
|
|||||||
|
|
||||||
/api/assets/import:
|
/api/assets/import:
|
||||||
post:
|
post:
|
||||||
operationId: importAssets
|
operationId: importPublishedAssets
|
||||||
tags: [assets]
|
tags: [assets]
|
||||||
summary: Import assets from external URLs
|
summary: "[cloud-only] Import published assets into the caller's library"
|
||||||
description: "[cloud-only] Imports one or more assets from external URLs into the cloud asset store."
|
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]
|
x-runtime: [cloud]
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: "#/components/schemas/ImportPublishedAssetsRequest"
|
||||||
required:
|
|
||||||
- imports
|
|
||||||
properties:
|
|
||||||
imports:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/components/schemas/AssetImportRequest"
|
|
||||||
description: Assets to import
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Import initiated
|
description: Successfully imported assets
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: object
|
$ref: "#/components/schemas/ImportPublishedAssetsResponse"
|
||||||
properties:
|
|
||||||
assets:
|
|
||||||
type: array
|
|
||||||
items:
|
|
||||||
$ref: "#/components/schemas/Asset"
|
|
||||||
"400":
|
"400":
|
||||||
description: Bad request
|
description: Bad request
|
||||||
content:
|
content:
|
||||||
@ -7379,24 +7367,35 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
description: Target path on the runtime filesystem
|
description: Target path on the runtime filesystem
|
||||||
|
|
||||||
AssetImportRequest:
|
ImportPublishedAssetsRequest:
|
||||||
type: object
|
type: object
|
||||||
x-runtime: [cloud]
|
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:
|
required:
|
||||||
- url
|
- published_asset_ids
|
||||||
properties:
|
properties:
|
||||||
url:
|
published_asset_ids:
|
||||||
type: string
|
|
||||||
format: uri
|
|
||||||
description: URL of the asset to import
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
description: Display name for the imported asset
|
|
||||||
tags:
|
|
||||||
type: array
|
type: array
|
||||||
|
description: IDs of published assets (inputs and models) to import.
|
||||||
items:
|
items:
|
||||||
type: string
|
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:
|
RemoteAssetMetadata:
|
||||||
type: object
|
type: object
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user