1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-02 23:14:49 +08:00

[openapi] Replace bare object schemas with proper component references

Replace inline object definitions for queue, history, and resource management
operations with reusable schema components:

- Add QueueManageRequest schema for /api/queue POST requests
- Add FreeResourcesRequest schema for /api/free POST requests
- Add HistoryManageRequest schema for /api/history POST requests
- Add UploadResponse schema for upload endpoints

This improves API consistency and reusability by moving common
object definitions to the components section.
This commit is contained in:
bymyself
2025-07-13 16:26:55 -07:00
parent d6270cbdf3
commit 7baed85b1d

View File

@@ -108,17 +108,7 @@ paths:
content:
application/json:
schema:
type: object
properties:
clear:
type: boolean
description: If true, clears the entire queue
delete:
type: array
description: Array of prompt IDs to delete from the queue
items:
type: string
format: uuid
$ref: '#/components/schemas/QueueManageRequest'
responses:
'200':
description: Success
@@ -144,14 +134,7 @@ paths:
content:
application/json:
schema:
type: object
properties:
unload_models:
type: boolean
description: If true, unloads models from memory
free_memory:
type: boolean
description: If true, frees GPU memory
$ref: '#/components/schemas/FreeResourcesRequest'
responses:
'200':
description: Success
@@ -190,17 +173,7 @@ paths:
content:
application/json:
schema:
type: object
properties:
clear:
type: boolean
description: If true, clears the entire history
delete:
type: array
description: Array of prompt IDs to delete from history
items:
type: string
format: uuid
$ref: '#/components/schemas/HistoryManageRequest'
responses:
'200':
description: Success
@@ -302,17 +275,7 @@ paths:
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: Filename of the uploaded image
subfolder:
type: string
description: Subfolder the image was stored in
type:
type: string
description: Type of directory the image was stored in
$ref: '#/components/schemas/UploadResponse'
'400':
description: Bad request
/api/upload/mask:
@@ -343,16 +306,7 @@ paths:
application/json:
schema:
type: object
properties:
name:
type: string
description: Filename of the uploaded mask
subfolder:
type: string
description: Subfolder the mask was stored in
type:
type: string
description: Type of directory the mask was stored in
$ref: '#/components/schemas/UploadResponse'
'400':
description: Bad request
/api/view:
@@ -893,3 +847,48 @@ components:
torch_vram_free:
type: number
description: Free VRAM as reported by PyTorch
QueueManageRequest:
type: object
properties:
clear:
type: boolean
description: If true, clears the entire queue
delete:
type: array
description: Array of prompt IDs to delete from the queue
items:
type: string
format: uuid
FreeResourcesRequest:
type: object
properties:
unload_models:
type: boolean
description: If true, unloads models from memory
free_memory:
type: boolean
description: If true, frees GPU memory
HistoryManageRequest:
type: object
properties:
clear:
type: boolean
description: If true, clears the entire history
delete:
type: array
description: Array of prompt IDs to delete from history
items:
type: string
format: uuid
UploadResponse:
type: object
properties:
name:
type: string
description: Filename of the uploaded file
subfolder:
type: string
description: Subfolder where the file was stored
type:
type: string
description: Type of directory the file was stored in