Add OpenAPI 3.1 specification for ComfyUI API#13397
Add OpenAPI 3.1 specification for ComfyUI API#13397MillerMedia wants to merge 5 commits intomasterfrom
Conversation
📝 WalkthroughWalkthroughThe pull request modifies the 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Adds a comprehensive OpenAPI 3.1 spec documenting all HTTP endpoints exposed by ComfyUI's server, including prompt execution, queue management, file uploads, userdata, settings, system stats, object info, assets, and internal routes. The spec was validated against the source code with adversarial review from multiple models, and passes Spectral linting with zero errors. Also removes openapi.yaml from .gitignore so the spec is tracked.
82a1e30 to
15d68e7
Compare
| # --------------------------------------------------------------------------- | ||
| # History | ||
| # --------------------------------------------------------------------------- | ||
| /api/history: |
There was a problem hiding this comment.
Since we're trying to deprecate this endpoint (in favor of /jobs), do we want to exclude it from the OpenAPI spec?
There was a problem hiding this comment.
Added deprecated:true and description on this one.
| "200": | ||
| description: History updated | ||
|
|
||
| /api/history/{prompt_id}: |
There was a problem hiding this comment.
Same comment as above -- should we include deprecated endpoints?
There was a problem hiding this comment.
Added deprecated:true and description on this one.
guill
left a comment
There was a problem hiding this comment.
Looks good to me other than either removing or documenting in some way that some endpoints (e.g. /api/history) are deprecated.
Address Jacob's review feedback on PR #13397 by explicitly marking the three /api/history operations as deprecated in the OpenAPI spec: * GET /api/history -> superseded by GET /api/jobs * POST /api/history -> superseded by /api/jobs management * GET /api/history/{prompt_id} -> superseded by GET /api/jobs/{job_id} Each operation gains deprecated: true plus a description that names the replacement. A formal sunset timeline (RFC 8594 Deprecation and RFC 8553 Sunset headers, minimum-runway policy) is being defined separately and will be applied as a follow-up.
I've added deprecated to the two endpoints called out. Any other endpoints planned for deprecation? |
- Add operation descriptions to 52 endpoints (prompt, queue, upload, view, models, userdata, settings, assets, internal, etc.) - Add schema descriptions to 22 component schemas - Add parameter descriptions to 8 path parameters that were missing them - Remove 6 unused component schemas: TaskOutput, EmbeddingsResponse, ExtensionsResponse, LogRawResponse, UserInfo, UserDataFullInfo No wire/shape changes. Reduces Spectral findings from 92 to 4. The remaining 4 are real issues (WebSocket 101 on /ws, loose error schema, and two snake_case warnings on real wire field names) and are worth addressing separately.
|
@guill heads up — ran Spectral against this spec (using our cloud ruleset as a baseline) and pushed a commit (3fcbaee) with the cosmetic fixes it surfaced:
No wire/shape changes. Findings went from 92 → 4. The remaining 4 are real issues I didn't want to bundle in a cosmetic sweep:
Happy to follow up on any of those separately. |
| oneOf: | ||
| - $ref: "#/components/schemas/UserDataResponseFull" | ||
| - $ref: "#/components/schemas/UserDataResponseShort" |
There was a problem hiding this comment.
You should really avoid using oneOf without a discriminator. When someone takes this spec and generates an SDK using openapi-generator, the code won't work as expected.
|
From my view, this PR and #13410 can go in at any time. As long as everyone's good to go. |
Summary
openapi.yaml) documenting all HTTP endpoints exposed by ComfyUI's serverx-websocket-messagesextension/api/prefix)openapi.yamlfrom.gitignoreso the spec is tracked in version controlDetails
The spec was:
server.py,app/,api_server/)Endpoints covered
/api/prompt,/api/queue/api/history,/api/history/{prompt_id}/api/view,/api/upload/image,/api/upload/mask/api/system_stats,/api/interrupt,/api/free/api/object_info,/api/object_info/{node_class}/api/userdata/*,/api/settings,/api/users/api/assets/*/api/experiment/models/*/api/jobs,/api/jobs/{job_id}/api/workflow_templates/api/embeddings/api/extensions/internal/*Test plan
npx @stoplight/spectral-cli lint openapi.yaml