From 1062bc6669590b5a96c489fd5abbe64b508c090d Mon Sep 17 00:00:00 2001 From: bymyself Date: Tue, 15 Jul 2025 15:02:13 -0700 Subject: [PATCH] Update OpenAPI to 3.1.0 with prefixItems for QueueItem structure - Changed OpenAPI version from 3.0.3 to 3.1.0 - Updated QueueItem schema to use prefixItems instead of oneOf for better tuple representation - Follows suggestion from PR review to use OpenAPI 3.1 features for array/tuple handling --- openapi.yaml | 805 ++------------------------------------------------- 1 file changed, 27 insertions(+), 778 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index bad7a4ce3..4c1dd67a8 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.3 +openapi: 3.1.0 info: title: ComfyUI API description: 'API for ComfyUI - A powerful and modular UI for Stable Diffusion. @@ -22,8 +22,8 @@ info: name: GNU General Public License v3.0 url: https://github.com/comfyanonymous/ComfyUI/blob/master/LICENSE servers: -- url: / - description: Default ComfyUI server +- url: https://example.com + description: ComfyUI server tags: - name: workflow description: Workflow execution and management @@ -50,12 +50,6 @@ paths: responses: '200': description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' content: application/json: schema: @@ -111,12 +105,6 @@ paths: responses: '200': description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' content: application/json: schema: @@ -204,18 +192,18 @@ paths: responses: '200': description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' content: application/json: schema: type: array items: $ref: '#/components/schemas/HistoryItem' + '500': + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' post: tags: - workflow @@ -255,539 +243,16 @@ paths: responses: '200': description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' content: application/json: schema: $ref: '#/components/schemas/HistoryItem' - /api/object_info: - get: - tags: - - node - summary: Get all node information - description: Returns information about all available nodes - operationId: getNodeInfo - responses: - '200': - description: Success '500': description: Internal server error content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: object - additionalProperties: - $ref: '#/components/schemas/NodeInfo' - /api/object_info/{node_class}: - get: - tags: - - node - summary: Get specific node information - description: Returns information about a specific node class - operationId: getNodeClassInfo - parameters: - - name: node_class - in: path - description: Name of the node class - required: true - schema: - type: string - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: object - additionalProperties: - $ref: '#/components/schemas/NodeInfo' - /api/upload/image: - post: - tags: - - image - summary: Upload an image - description: Uploads an image to the server - operationId: uploadImage - requestBody: - required: true - content: - multipart/form-data: - schema: - type: object - required: - - image - properties: - image: - type: string - format: binary - description: The image file to upload - overwrite: - type: string - enum: - - "true" - - "false" - description: Whether to overwrite if file exists - type: - type: string - enum: - - input - - temp - - output - default: input - description: Type of directory to store the image in - subfolder: - type: string - default: "" - description: Subfolder to store the image in - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - $ref: '#/components/schemas/UploadResponse' - '400': - description: Bad request - /api/upload/mask: - post: - tags: - - image - summary: Upload a mask for an image - description: Uploads a mask image and applies it to a referenced original image - operationId: uploadMask - requestBody: - required: true - content: - multipart/form-data: - schema: - type: object - required: - - image - - original_ref - properties: - image: - type: string - format: binary - description: The mask image file to upload - original_ref: - type: string - description: JSON string containing reference to the original image - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: object - $ref: '#/components/schemas/UploadResponse' - '400': - description: Bad request - /api/view: - get: - tags: - - image - summary: View an image - description: Retrieves an image from the server - operationId: viewImage - parameters: - - name: filename - in: query - description: Name of the file to retrieve - required: true - schema: - type: string - - name: type - in: query - description: Type of directory to retrieve from - required: false - schema: - type: string - enum: - - input - - temp - - output - default: output - - name: subfolder - in: query - description: Subfolder to retrieve from - required: false - schema: - type: string - - name: preview - in: query - description: Preview options (format;quality) - required: false - schema: - type: string - - name: channel - in: query - description: Channel to retrieve (rgb, a, rgba) - required: false - schema: - type: string - enum: - - rgb - - a - - rgba - default: rgba - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - image/*: - schema: - type: string - format: binary - '400': - description: Bad request - '404': - description: File not found - /api/view_metadata/{folder_name}: - get: - tags: - - model - summary: View model metadata - description: Retrieves metadata from a safetensors file - operationId: viewModelMetadata - parameters: - - name: folder_name - in: path - description: Name of the model folder - required: true - schema: - type: string - - name: filename - in: query - description: Name of the safetensors file - required: true - schema: - type: string - responses: - '200': - description: Success - content: - application/json: - schema: - $ref: '#/components/schemas/ModelMetadata' - '404': - description: File not found - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - /api/models: - get: - tags: - - model - summary: Get model types - description: Returns a list of available model types - operationId: getModelTypes - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: array - items: - type: string - /api/models/{folder}: - get: - tags: - - model - summary: Get models of a specific type - description: Returns a list of available models of a specific type - operationId: getModels - parameters: - - name: folder - in: path - description: Model type folder - required: true - schema: - type: string - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: array - items: - type: string - '404': - description: Folder not found - /api/embeddings: - get: - tags: - - model - summary: Get embeddings - description: Returns a list of available embeddings - operationId: getEmbeddings - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: array - items: - type: string - /api/extensions: - get: - tags: - - system - summary: Get extensions - description: Returns a list of available extensions - operationId: getExtensions - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: array - items: - type: string - /api/system_stats: - get: - tags: - - system - summary: Get system statistics - description: Returns system information including RAM, VRAM, and ComfyUI version - operationId: getSystemStats - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - $ref: '#/components/schemas/SystemStats' - /api/ws: - get: - tags: - - workflow - summary: WebSocket connection - description: 'Establishes a WebSocket connection for real-time communication. - - This endpoint is used for receiving progress updates, status changes, and - results from workflow executions. - - ' - operationId: webSocketConnect - parameters: - - name: clientId - in: query - description: Optional client ID for reconnection - required: false - schema: - type: string - responses: - '101': - description: Switching Protocols to WebSocket - /api/features: - get: - tags: - - system - summary: Get server feature flags - description: Returns the server's feature flags and capabilities - operationId: getFeatures - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - $ref: '#/components/schemas/ServerFeatures' - /internal/logs: - get: - tags: - - internal - summary: Get logs - description: Returns system logs as a single string - operationId: getLogs - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: string - /internal/logs/raw: - get: - tags: - - internal - summary: Get raw logs - description: Returns raw system logs with terminal size information - operationId: getRawLogs - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - $ref: '#/components/schemas/RawLogsResponse' - /internal/logs/subscribe: - patch: - tags: - - internal - summary: Subscribe to logs - description: Subscribe or unsubscribe to log updates - operationId: subscribeToLogs - requestBody: - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/LogsSubscribeRequest' - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - /internal/folder_paths: - get: - tags: - - internal - summary: Get folder paths - description: Returns a map of folder names to their paths - operationId: getFolderPaths - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: object - additionalProperties: - type: string - /internal/files/{directory_type}: - get: - tags: - - internal - summary: Get files - description: Returns a list of files in a specific directory type - operationId: getFiles - parameters: - - name: directory_type - in: path - description: Type of directory (output, input, temp) - required: true - schema: - type: string - enum: - - output - - input - - temp - responses: - '200': - description: Success - '500': - description: Internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorResponse' - content: - application/json: - schema: - type: array - items: - type: string - '400': - description: Invalid directory type components: schemas: PromptRequest: @@ -888,125 +353,6 @@ components: type: object description: Output data from the execution additionalProperties: true - NodeInfo: - type: object - properties: - input: - type: object - description: Input specifications for the node - additionalProperties: true - input_order: - type: object - description: Order of inputs for display - additionalProperties: - type: array - items: - type: string - output: - type: array - items: - type: string - description: Output types of the node - output_is_list: - type: array - items: - type: boolean - description: Whether each output is a list - output_name: - type: array - items: - type: string - description: Names of the outputs - name: - type: string - description: Internal name of the node - display_name: - type: string - description: Display name of the node - description: - type: string - description: Description of the node - python_module: - type: string - description: Python module implementing the node - category: - type: string - description: Category of the node - output_node: - type: boolean - description: Whether this is an output node - output_tooltips: - type: array - items: - type: string - description: Tooltips for outputs - deprecated: - type: boolean - description: Whether the node is deprecated - experimental: - type: boolean - description: Whether the node is experimental - api_node: - type: boolean - description: Whether this is an API node - SystemStats: - type: object - properties: - system: - type: object - properties: - os: - type: string - description: Operating system - ram_total: - type: number - description: Total system RAM in bytes - ram_free: - type: number - description: Free system RAM in bytes - comfyui_version: - type: string - description: ComfyUI version - python_version: - type: string - description: Python version - pytorch_version: - type: string - description: PyTorch version - embedded_python: - type: boolean - description: Whether using embedded Python - argv: - type: array - items: - type: string - description: Command line arguments - devices: - type: array - items: - type: object - properties: - name: - type: string - description: Device name - type: - type: string - description: Device type - index: - type: integer - description: Device index (may be omitted for CPU devices) - vram_total: - type: number - description: Total VRAM in bytes - vram_free: - type: number - description: Free VRAM in bytes - torch_vram_total: - type: number - description: Total VRAM as reported by PyTorch - torch_vram_free: - type: number - description: Free VRAM as reported by PyTorch QueueManageRequest: type: object properties: @@ -1040,120 +386,23 @@ components: 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 - ServerFeatures: - type: object - properties: - supports_preview_metadata: - type: boolean - description: Whether the server supports preview metadata - max_upload_size: - type: integer - description: Maximum file upload size in bytes - RawLogsResponse: - type: object - properties: - entries: - type: array - items: - $ref: '#/components/schemas/LogEntry' - size: - $ref: '#/components/schemas/TerminalSize' - LogEntry: - type: object - properties: - t: - type: string - description: Timestamp - m: - type: string - description: Message - TerminalSize: - type: object - properties: - cols: - type: integer - description: Terminal columns - rows: - type: integer - description: Terminal rows - LogsSubscribeRequest: - type: object - required: - - clientId - - enabled - properties: - clientId: - type: string - description: Client ID - enabled: - type: boolean - description: Whether to enable or disable subscription - ModelMetadata: - type: object - description: Model metadata from safetensors files - properties: - modelspec.date: - type: string - description: Model creation date - modelspec.architecture: - type: string - description: Model architecture (e.g., stable-diffusion-v1) - modelspec.title: - type: string - description: Model title - modelspec.description: - type: string - description: Model description - modelspec.sai_model_spec: - type: string - description: SAI model specification version - format: - type: string - description: Model format (e.g., pt, safetensors) - modelspec.implementation: - type: string - description: Implementation URL or reference - modelspec.license: - type: string - description: Model license - modelspec.author: - type: string - description: Model author(s) - modelspec.thumbnail: - type: string - description: Base64-encoded thumbnail image - additionalProperties: - type: string - description: Additional metadata fields QueueItem: type: array - description: Queue item containing execution details - items: - oneOf: - - type: integer - description: Queue position number - - type: string - format: uuid - description: Unique prompt identifier - - type: object - description: Workflow graph with nodes and connections - additionalProperties: true - - type: object - description: Extra metadata (auth tokens, client info, etc.) - additionalProperties: true - - type: array - description: Array of output node IDs - items: - type: string + description: Queue item containing execution details as a tuple [position, prompt_id, prompt, extra_data, outputs_to_execute] + prefixItems: + - type: number + description: Queue position number (lower numbers have higher priority) + - type: string + format: uuid + description: Unique prompt identifier + - type: object + description: Workflow graph with nodes and connections + additionalProperties: true + - type: object + description: Extra metadata (auth tokens, client info, etc.) + additionalProperties: true + - type: array + description: Array of output node IDs + items: + type: string + items: false \ No newline at end of file