From 7baed85b1daf22e7c0ef26470589400012ddf143 Mon Sep 17 00:00:00 2001 From: bymyself Date: Sun, 13 Jul 2025 16:26:55 -0700 Subject: [PATCH] [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. --- openapi.yaml | 101 +++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index eba4079f..d62466b8 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -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