Files
dify/api/controllers/openapi/__init__.py
GareArc f2ec17be9b feat(openapi): unified POST /apps/<id>/run with per-mode dispatch
Single bearer-accepting run route on the openapi namespace. Server
reads apps.mode after AppResolver and dispatches via the _DISPATCH
table to the per-mode helper. Per-mode constraints enforced inside
helpers (422). Service-API /v1/* per-mode routes untouched.

Also fixes a pre-existing latent bug in the openapi integration
fixtures: App() rows were constructed without enable_site, which
DB INSERT rejected (column is NOT NULL with no default). Now set
enable_site=True alongside enable_api=True in the three fixtures
that construct App() rows.
2026-05-07 00:35:47 -07:00

48 lines
922 B
Python

from flask import Blueprint
from flask_restx import Namespace
from libs.device_flow_security import attach_anti_framing
from libs.external_api import ExternalApi
bp = Blueprint("openapi", __name__, url_prefix="/openapi/v1")
attach_anti_framing(bp)
api = ExternalApi(
bp,
version="1.0",
title="OpenAPI",
description="User-scoped programmatic API (bearer auth)",
)
openapi_ns = Namespace("openapi", description="User-scoped operations", path="/")
from . import (
account,
app_run,
apps,
apps_permitted,
chat_messages,
completion_messages,
index,
oauth_device,
oauth_device_sso,
workflow_run,
workspaces,
)
__all__ = [
"account",
"app_run",
"apps",
"apps_permitted",
"chat_messages",
"completion_messages",
"index",
"oauth_device",
"oauth_device_sso",
"workflow_run",
"workspaces",
]
api.add_namespace(openapi_ns)