mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-04 09:17:12 +08:00
Update instructions on how to develop API Nodes. (#171)
This commit is contained in:
parent
2bae475fba
commit
78753cc8a1
@ -28,7 +28,7 @@ When developing locally, use the `redocly-dev.yaml` file to generate pydantic mo
|
|||||||
Before your API node PR merges, make sure to add the `Released` tag to the `openapi.yaml` file and test in staging.
|
Before your API node PR merges, make sure to add the `Released` tag to the `openapi.yaml` file and test in staging.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Download the OpenAPI file from prod server.
|
# Download the OpenAPI file from staging server.
|
||||||
curl -o openapi.yaml https://stagingapi.comfy.org/openapi
|
curl -o openapi.yaml https://stagingapi.comfy.org/openapi
|
||||||
|
|
||||||
# Filter out unneeded API definitions.
|
# Filter out unneeded API definitions.
|
||||||
@ -39,3 +39,25 @@ redocly bundle openapi.yaml --output filtered-openapi.yaml --config comfy_api_no
|
|||||||
datamodel-codegen --use-subclass-enum --field-constraints --strict-types bytes --input filtered-openapi.yaml --output comfy_api_nodes/apis/__init__.py --output-model-type pydantic_v2.BaseModel
|
datamodel-codegen --use-subclass-enum --field-constraints --strict-types bytes --input filtered-openapi.yaml --output comfy_api_nodes/apis/__init__.py --output-model-type pydantic_v2.BaseModel
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# Merging to Master
|
||||||
|
|
||||||
|
Before merging to comfyanonymous/ComfyUI master, follow these steps:
|
||||||
|
|
||||||
|
1. Add the "Released" tag to the ComfyUI OpenAPI yaml file for each endpoint you are using in the nodes.
|
||||||
|
1. Make sure the ComfyUI API is deployed to prod with your changes.
|
||||||
|
1. Run the code generation again with `redocly.yaml` and the production OpenAPI yaml file.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Download the OpenAPI file from prod server.
|
||||||
|
curl -o openapi.yaml https://api.comfy.org/openapi
|
||||||
|
|
||||||
|
# Filter out unneeded API definitions.
|
||||||
|
npm install -g @redocly/cli
|
||||||
|
redocly bundle openapi.yaml --output filtered-openapi.yaml --config comfy_api_nodes/redocly.yaml --remove-unused-components
|
||||||
|
|
||||||
|
# Generate the pydantic datamodels for validation.
|
||||||
|
datamodel-codegen --use-subclass-enum --field-constraints --strict-types bytes --input filtered-openapi.yaml --output comfy_api_nodes/apis/__init__.py --output-model-type pydantic_v2.BaseModel
|
||||||
|
|
||||||
|
```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user