Skip to content

Add OpenAPI spec and API testing framework for ComfyUI Webserver #8219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

christian-byrne
Copy link
Collaborator

@christian-byrne christian-byrne commented May 20, 2025

Adds an OpenAPI 3.0 specification for the ComfyUI HTTP API, providing formal documentation for all web endpoints.

This makes it easier for developers to dicover and understand the API, build clients, and ensure API reliability. A formalized spec also allows semantic versioning of the webserver API with changelogs, which will be of benefit to the large volume of apps using the API, and can reduce friction associated with future changes to the server (e.g., for cloud mixed inference, distributed prompt queues, async clients, multi-process-nodes, async nodes, and so on).

The PR includes:

  • An OpenAPI spec for ComfyUI's HTTP API endpoints
  • A testing framework that validates the spec against a running ComfyUI instance
  • Tests to ensure endpoints exist and responses match defined schemas
  • Tests for spec syntax and style

Later there can be automatic type generation and the option to enable request validation.

@robinjhuang
Copy link
Collaborator

robinjhuang commented May 21, 2025

Can we add this a GH action to validate changes to this file?
https://github.com/marketplace/actions/swagger-editor-validator

The docker version of this works well.

name: Validate OpenAPI 

on:
  push:
    branches: [ master ]
    paths:
      - 'openapi.yml'
  pull_request:
    branches: [ master ]
    paths:
      - 'openapi.yml'
jobs:
  openapi-check:
    runs-on: ubuntu-latest

    # Service containers to run with `runner-job`
    services:
      # Label used to access the service container
      swagger-editor:
        # Docker Hub image
        image: swaggerapi/swagger-editor
        ports:
          # Maps port 8080 on service container to the host 80
          - 80:8080

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Validate OpenAPI definition
        uses: swaggerexpert/swagger-editor-validate@v1
        with:
          definition-file: openapi.yml
          swagger-editor-url: http://localhost/
          default-timeout: 20000

@christian-byrne
Copy link
Collaborator Author

Changes:

  • Created .github/workflows/openapi-validation.yml that:
    • Triggers on pushes/PRs to master when openapi.yaml changes
    • Uses swagger-editor service container for validation
    • Runs both the suggested swagger-editor-validate action and our existing spec validation tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants