Compare commits

..

7 Commits

Author SHA1 Message Date
fcc2b1f066 Add description, update category 2026-05-22 11:25:25 +08:00
70ebe28cd6 Merge branch 'alexis/split_image_channel' of https://github.com/Comfy-Org/ComfyUI into alexis/split_image_channel 2026-04-24 15:30:32 +08:00
ca94b7ead3 Update search aliases 2026-04-24 15:29:22 +08:00
3520f32e22 Merge branch 'master' into alexis/split_image_channel 2026-04-24 15:23:03 +08:00
547ed9b4a9 Add new node to split image channels 2026-04-24 15:14:20 +08:00
443074eee9 Add OpenAPI 3.1 specification for ComfyUI API (#13397)
* Add OpenAPI 3.1 specification for ComfyUI API

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.

* Mark /api/history endpoints as 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.

* Address Spectral lint findings in openapi.yaml

- 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.

* fix(openapi): address jtreminio oneOf review on /api/userdata

Restructure the UserData response schemas to address the review feedback
on the `oneOf` without a discriminator, and fix two accuracy bugs found
while doing it.

Changes
- GET /api/userdata response: extract the inline `oneOf` to a named
  schema (`ListUserdataResponse`) and add the missing third variant
  returned when `split=true` and `full_info=false` (array of
  `[relative_path, ...path_components]`). Previously only two of the
  three actual server response shapes were described.
- UserDataResponse (POST endpoints): correct the description — this
  schema is a single item, not a list — and point at the canonical
  `GetUserDataResponseFullFile` schema instead of the duplicate
  `UserDataResponseFull`. Also removes the malformed blank line in
  `UserDataResponseShort`.
- Delete the now-unused `UserDataResponseFull` and
  `UserDataResponseShort` schemas (replaced by reuse of
  `GetUserDataResponseFullFile` and an inline string variant).
- Add an `x-variant-selector` vendor extension to both `oneOf` sites
  documenting which query-parameter combination selects which branch,
  since a true OpenAPI `discriminator` is not applicable (the variants
  are type-disjoint and the selector lives in the request, not the
  response body).

This keeps the shapes the server actually emits (no wire-breaking
change) while making the selection rule explicit for SDK generators
and readers.

---------

Co-authored-by: guill <jacob.e.segal@gmail.com>
2026-04-23 21:00:25 -07:00
2e0503780d range type (#13322)
Co-authored-by: guill <jacob.e.segal@gmail.com>
2026-04-23 20:51:34 -07:00
3 changed files with 3263 additions and 1 deletions

1
.gitignore vendored
View File

@ -21,6 +21,5 @@ venv*/
*.log
web_custom_versions/
.DS_Store
openapi.yaml
filtered-openapi.yaml
uv.lock

View File

@ -185,6 +185,37 @@ class SplitImageWithAlpha(io.ComfyNode):
return io.NodeOutput(torch.stack(out_images), 1.0 - torch.stack(out_alphas))
class SplitImageChannels(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="SplitImageChannels",
search_aliases=["convert to grayscale", "extract channels", "grayscale", "split channels", "RGB channels"],
display_name="Split Image Channels",
category="image/compositing",
description="Splits an image into its red, green, blue, and alpha channels.",
inputs=[
io.Image.Input("image"),
],
outputs=[
io.Image.Output(display_name="red"),
io.Image.Output(display_name="green"),
io.Image.Output(display_name="blue"),
io.Mask.Output(display_name="alpha")
],
)
@classmethod
def execute(cls, image: torch.Tensor) -> io.NodeOutput:
images = [i[:,:,:3] for i in image]
stacked = torch.stack(images)
reds = stacked[:, :, :, 0:1].repeat(1, 1, 1, 3)
greens = stacked[:, :, :, 1:2].repeat(1, 1, 1, 3)
blues = stacked[:, :, :, 2:3].repeat(1, 1, 1, 3)
alphas = [i[:,:,3] if i.shape[2] > 3 else torch.ones_like(i[:,:,0]) for i in image]
return io.NodeOutput(reds, greens, blues, 1.0 - torch.stack(alphas))
class JoinImageWithAlpha(io.ComfyNode):
@classmethod
def define_schema(cls):
@ -217,6 +248,7 @@ class CompositingExtension(ComfyExtension):
async def get_node_list(self) -> list[type[io.ComfyNode]]:
return [
PorterDuffImageComposite,
SplitImageChannels,
SplitImageWithAlpha,
JoinImageWithAlpha,
]

3231
openapi.yaml Normal file

File diff suppressed because it is too large Load Diff